Update the test

This commit is contained in:
Jesse CreateThis
2025-08-22 12:53:18 -04:00
parent fe86282efe
commit 3d00d625cd
2 changed files with 51 additions and 8 deletions

View File

@@ -197,7 +197,51 @@ static void test_deepseek_v3_1() {
/* .thinking_forced_open = */ false,
/* .parse_tool_calls = */ true,
};
common_chat_msg_parser builder("REASONING</think>ok", /* is_partial= */ false, {});
common_chat_msg_parser builder("REASONING</think>ok", /* is_partial= */ false, syntax);
assert_equals(std::string("REASONING"), builder.result().reasoning_content);
assert_equals(std::string("ok"), builder.result().content);
}
// Test with whitespace around reasoning content
{
common_chat_syntax syntax = {
/* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
/* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
/* .reasoning_in_content = */ false,
/* .thinking_forced_open = */ false,
/* .parse_tool_calls = */ true,
};
common_chat_msg_parser builder(" REASONING WITH SPACES </think>ok", /* is_partial= */ false, syntax);
assert_equals(std::string("REASONING WITH SPACES"), builder.result().reasoning_content);
assert_equals(std::string("ok"), builder.result().content);
}
// Test without thinking tag (should be all regular content)
{
common_chat_syntax syntax = {
/* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
/* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
/* .reasoning_in_content = */ false,
/* .thinking_forced_open = */ false,
/* .parse_tool_calls = */ true,
};
common_chat_msg_parser builder("just regular content", /* is_partial= */ false, syntax);
assert_equals(std::string(""), builder.result().reasoning_content);
assert_equals(std::string("just regular content"), builder.result().content);
}
// Test with empty reasoning content
{
common_chat_syntax syntax = {
/* .format = */ COMMON_CHAT_FORMAT_DEEPSEEK_V3_1,
/* .reasoning_format = */ COMMON_REASONING_FORMAT_DEEPSEEK,
/* .reasoning_in_content = */ false,
/* .thinking_forced_open = */ false,
/* .parse_tool_calls = */ true,
};
common_chat_msg_parser builder(" </think>ok", /* is_partial= */ false, syntax);
assert_equals(std::string(""), builder.result().reasoning_content);
assert_equals(std::string("ok"), builder.result().content);
}
}
@@ -362,6 +406,7 @@ int main() {
test_json_with_dumped_args();
test_reasoning();
test_regex();
test_deepseek_v3_1();
std::cout << "All tests passed!\n";
return 0;
}