Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advanced collation - giving more info on CPP failures #396

Merged
merged 13 commits into from
Feb 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions executors/cpp/coll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ auto TestCollator(json_object *json_in) -> string {
// Make sure normalization is consistent
rb_coll = new RuleBasedCollator(uni_rules, UCOL_ON, status);
if (check_icu_error(status, return_json, "create RuleBasedCollator")) {
// Put json_in as the actual input received.
json_object_object_add(
return_json, "actual_input",
json_object_new_string(json_object_get_string(json_in)));

return json_object_to_json_string(return_json);
}

Expand Down Expand Up @@ -217,9 +222,13 @@ auto TestCollator(json_object *json_in) -> string {
if (compare_type_string == "" || compare_type_string.substr(0, 1) == "<") {
// Default checking for <= 0.
coll_result = (uni_result != UCOL_GREATER);
} else {
coll_result = (uni_result == UCOL_EQUAL);
}
} else
if (compare_type_string == "=") {
coll_result = (uni_result == UCOL_EQUAL);
} else {
//
sven-oly marked this conversation as resolved.
Show resolved Hide resolved
coll_result = (uni_result == UCOL_EQUAL);
}

if (!coll_result) {
// Test did not succeed!
Expand All @@ -229,6 +238,10 @@ auto TestCollator(json_object *json_in) -> string {
json_object_object_add(
return_json, "s2", json_object_new_string(string2.c_str()));

json_object_object_add(
return_json, "actual_input",
json_object_new_string(json_object_get_string(json_in)));

// Record the actual returned value
json_object_object_add(
return_json, "compare", json_object_new_int64(uni_result));
Expand Down
Loading