Skip to content

Commit

Permalink
Advanced collation - giving more info on CPP failures (#396)
Browse files Browse the repository at this point in the history
* Resolve diff in node version

* Adding ICU74 test data and collationtest.txt for older versions

* Fix error in collation parameters. fix rust formatting.

* Fix collation call in Node - removes 85% of test failures

* Add more info for failing CPP collation
  • Loading branch information
sven-oly authored Feb 6, 2025
1 parent dc029e8 commit d1a019c
Showing 1 changed file with 16 additions and 3 deletions.
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 {
//
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

0 comments on commit d1a019c

Please sign in to comment.