Skip to content

Commit

Permalink
fix: adapt randomize query results to target architecture. x86 and AR…
Browse files Browse the repository at this point in the history
…M have possibly different std::hash results (#355)
  • Loading branch information
Taepper authored Mar 22, 2024
1 parent 473cd98 commit 600000d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/silo/test/randomize.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,23 @@ const QueryTestScenario RANDOMIZE_SEED = {
R"({"action": {"type": "Details", "fields": ["key"], "randomize": {"seed": 1231}},
"filterExpression": {"type": "True"}})"
),
#ifdef TARGET_CPU_ARM
.expected_query_result = json::parse(
R"([{"key": "id1"},
{"key": "id4"},
{"key": "id3"},
{"key": "id5"},
{"key": "id2"}])"
)
#else
.expected_query_result = json::parse(
R"([{"key": "id4"},
{"key": "id1"},
{"key": "id5"},
{"key": "id2"},
{"key": "id3"}])"
)
#endif
};

const QueryTestScenario RANDOMIZE_SEED_DIFFERENT = {
Expand All @@ -89,13 +99,23 @@ const QueryTestScenario RANDOMIZE_SEED_DIFFERENT = {
R"({"action": {"type": "Details", "fields": ["key"], "randomize": {"seed": 12312}},
"filterExpression": {"type": "True"}})"
),
#ifdef TARGET_CPU_ARM
.expected_query_result = json::parse(
R"([{"key": "id2"},
{"key": "id1"},
{"key": "id4"},
{"key": "id5"},
{"key": "id3"}])"
)
#else
.expected_query_result = json::parse(
R"([{"key": "id1"},
{"key": "id4"},
{"key": "id3"},
{"key": "id2"},
{"key": "id5"}])"
)
#endif
};

const QueryTestScenario EXPLICIT_DO_NOT_RANDOMIZE = {
Expand All @@ -119,13 +139,23 @@ const QueryTestScenario AGGREGATE = {
R"({"action": {"type": "Aggregated", "groupByFields": ["key"], "randomize": {"seed": 12321}},
"filterExpression": {"type": "True"}})"
),
#ifdef TARGET_CPU_ARM
.expected_query_result = json::parse(
R"([{"count": 1, "key": "id1"},
{"count": 1, "key": "id4"},
{"count": 1, "key": "id2"},
{"count": 1, "key": "id3"},
{"count": 1, "key": "id5"}])"
)
#else
.expected_query_result = json::parse(
R"([{"count": 1, "key": "id3"},
{"count": 1, "key": "id1"},
{"count": 1, "key": "id4"},
{"count": 1, "key": "id5"},
{"count": 1, "key": "id2"}])"
)
#endif
};

const QueryTestScenario ORDER_BY_PRECEDENCE = {
Expand Down Expand Up @@ -190,8 +220,13 @@ const QueryTestScenario AGGREGATE_LIMIT_RANDOMIZE = {
"filterExpression": {"type": "True"}})"
),
.expected_query_result = json::parse(
#ifdef TARGET_CPU_ARM
R"([{"count": 1, "key": "id5", "col": "A"},
{"count": 1, "key": "id3", "col": "A"}])"
#else
R"([{"count": 1, "key": "id1", "col": "A"},
{"count": 1, "key": "id3", "col": "A"}])"
#endif
)
};

Expand Down

0 comments on commit 600000d

Please sign in to comment.