清理废弃模块并完善测试基础设施
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#include "TestHarness.h"
|
||||
|
||||
#include "src/assistant/CommandDispatcher.h"
|
||||
#include "src/assistant/IntentRouter.h"
|
||||
|
||||
QA_TEST(IntentRouting, TrimsChatText)
|
||||
{
|
||||
const UserIntent intent = IntentRouter().route(QStringLiteral(" 你好 "));
|
||||
QA_EXPECT_EQ(intent.type, UserIntentType::Chat);
|
||||
QA_EXPECT_EQ(intent.text, QStringLiteral("你好"));
|
||||
}
|
||||
|
||||
QA_TEST(IntentRouting, ReminderHasPriorityOverWeather)
|
||||
{
|
||||
const UserIntent intent = IntentRouter().route(QStringLiteral("明天提醒我看天气"));
|
||||
QA_EXPECT_EQ(intent.type, UserIntentType::Reminder);
|
||||
}
|
||||
|
||||
QA_TEST(IntentRouting, RecognizesWeatherExpressions)
|
||||
{
|
||||
const IntentRouter router;
|
||||
QA_EXPECT_EQ(router.route(QStringLiteral("西安天气怎么样")).type, UserIntentType::Weather);
|
||||
QA_EXPECT_EQ(router.route(QStringLiteral("明天会不会下雨")).type, UserIntentType::Weather);
|
||||
QA_EXPECT_EQ(router.route(QStringLiteral("外面冷不冷")).type, UserIntentType::Weather);
|
||||
}
|
||||
|
||||
QA_TEST(IntentRouting, RemovedLocalCapabilitiesRemainChat)
|
||||
{
|
||||
const IntentRouter router;
|
||||
QA_EXPECT_EQ(router.route(QStringLiteral("读取文件")).type, UserIntentType::Chat);
|
||||
QA_EXPECT_EQ(router.route(QStringLiteral("打开 Codex")).type, UserIntentType::Chat);
|
||||
QA_EXPECT_EQ(router.route(QStringLiteral("分析这个项目")).type, UserIntentType::Chat);
|
||||
QA_EXPECT_EQ(router.route(QStringLiteral("创建 test.txt")).type, UserIntentType::Chat);
|
||||
}
|
||||
|
||||
QA_TEST(IntentRouting, DispatcherMapsSupportedActions)
|
||||
{
|
||||
const CommandDispatcher dispatcher;
|
||||
QA_EXPECT_EQ(dispatcher.dispatch(QStringLiteral("提醒我休息")).action, CommandDispatchAction::Reminder);
|
||||
QA_EXPECT_EQ(dispatcher.dispatch(QStringLiteral("北京天气")).action, CommandDispatchAction::Weather);
|
||||
QA_EXPECT_EQ(dispatcher.dispatch(QStringLiteral("讲个笑话")).action, CommandDispatchAction::Chat);
|
||||
}
|
||||
Reference in New Issue
Block a user