MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / test_msg_diffs_compute

Function test_msg_diffs_compute

tests/test-chat.cpp:4324–4400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4322}
4323
4324static void test_msg_diffs_compute() {
4325 LOG_DBG("%s\n", __func__);
4326 {
4327 common_chat_msg msg1;
4328
4329 common_chat_msg msg2;
4330 msg2.content = "Hello, world!";
4331
4332 common_chat_msg_diff diff;
4333 diff.content_delta = "Hello, world!";
4334
4335 assert_equals({ diff }, common_chat_msg_diff::compute_diffs(msg1, msg2));
4336 }
4337 {
4338 common_chat_msg msg1;
4339 msg1.content = "Hello,";
4340
4341 common_chat_msg msg2;
4342 msg2.content = "Hello, world!";
4343
4344 common_chat_msg_diff diff;
4345 diff.content_delta = " world!";
4346
4347 assert_equals({ diff }, common_chat_msg_diff::compute_diffs(msg1, msg2));
4348 }
4349 {
4350 common_chat_msg msg0;
4351
4352 common_chat_msg msg1;
4353 msg1.tool_calls = {
4354 { "special_function", "{\"ar", /* .id = */ "123" }
4355 };
4356
4357 common_chat_msg msg2;
4358 msg2.tool_calls = {
4359 { "special_function", "{\"arg1\": 1}", /* .id = */ "123" }
4360 };
4361
4362 common_chat_msg_diff diff01;
4363 diff01.tool_call_index = 0;
4364 diff01.tool_call_delta.name = "special_function";
4365 diff01.tool_call_delta.id = "123";
4366 diff01.tool_call_delta.arguments = "{\"ar";
4367
4368 assert_equals({ diff01 }, common_chat_msg_diff::compute_diffs(msg0, msg1));
4369
4370 common_chat_msg_diff diff12;
4371 diff12.tool_call_index = 0;
4372 // Note: neither id nor name change here.
4373 diff12.tool_call_delta.arguments = "g1\": 1}";
4374
4375 assert_equals({ diff12 }, common_chat_msg_diff::compute_diffs(msg1, msg2));
4376 }
4377 {
4378 common_chat_msg msg0;
4379
4380 common_chat_msg msg2;
4381 msg2.tool_calls = {

Callers 1

mainFunction · 0.85

Calls 1

assert_equalsFunction · 0.70

Tested by

no test coverage detected