MCPcopy Index your code
hub / github.com/appdevforall/CodeOnTheGo / assert_msg_equals

Function assert_msg_equals

subprojects/llama.cpp/tests/test-chat.cpp:153–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151 }
152}
153static void assert_msg_equals(const common_chat_msg & expected, const common_chat_msg & actual, bool ignore_whitespace_differences = false) {
154 assert_equals(expected.role, actual.role);
155 if (ignore_whitespace_differences) {
156 assert_equals(string_strip(expected.content), string_strip(actual.content));
157 } else {
158 assert_equals(expected.content, actual.content);
159 }
160 assert_equals(expected.content_parts.size(), actual.content_parts.size());
161 for (size_t i = 0; i < expected.content_parts.size(); i++) {
162 const auto & expected_part = expected.content_parts[i];
163 const auto & actual_part = actual.content_parts[i];
164 assert_equals(expected_part.type, actual_part.type);
165 if (ignore_whitespace_differences) {
166 assert_equals(string_strip(expected_part.text), string_strip(actual_part.text));
167 } else {
168 assert_equals(expected_part.text, actual_part.text);
169 }
170 }
171 if (ignore_whitespace_differences) {
172 assert_equals(string_strip(expected.reasoning_content), string_strip(actual.reasoning_content));
173 } else {
174 assert_equals(expected.reasoning_content, actual.reasoning_content);
175 }
176 assert_equals(expected.tool_calls.size(), actual.tool_calls.size());
177 for (size_t i = 0; i < expected.tool_calls.size(); i++) {
178 const auto & expected_tool_call = expected.tool_calls[i];
179 const auto & actual_tool_call = actual.tool_calls[i];
180 assert_equals(expected_tool_call.name, actual_tool_call.name);
181 assert_equals(renormalize_json(expected_tool_call.arguments), renormalize_json(actual_tool_call.arguments));
182 assert_equals(expected_tool_call.id, actual_tool_call.id);
183 }
184}
185
186common_chat_tool special_function_tool {
187 /* .name = */ "special_function",

Callers 5

test_templatesFunction · 0.85
test_peg_parserFunction · 0.85

Calls 4

string_stripFunction · 0.85
renormalize_jsonFunction · 0.85
assert_equalsFunction · 0.70
sizeMethod · 0.65

Tested by

no test coverage detected