8000 Print tested data on assertion failure (#21825) · arangodb/arangodb@09220c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 09220c4

Browse files
authored
Print tested data on assertion failure (#21825)
1 parent d0979f9 commit 09220c4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/js/client/aql/vector/aql-vector.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,13 @@ function VectorIndexL2TestSuite() {
275275
// Assert that results are deterministic
276276
if (i !== 0) {
277277
for (let j = 0; j < previousResult.length; ++j) {
278-
assertEqual(previousResult[j].key, results[j].key);
278+
assertEqual(previousResult[j].key, results[j].key, "Results are not deterministic: " + JSON.stringify(results));
279279
}
280280
}
281281

282282
// For l2 metric the results must be ordered in descending order
283283
for (let j = 1; j < results.length; ++j) {
284-
assertTrue(results[j - 1].dist <= results[j].dist);
284+
assertTrue(results[j - 1].dist <= results[j].dist, "Results are not in ascending order: " + JSON.stringify(results));
285285
}
286286
}
287287
},
@@ -420,7 +420,7 @@ function VectorIndexL2TestSuite() {
420420
const skipKeys = new Set(resultsWithSkip.map(r => r.k));
421421
const withoutSkipKeys = new Set(resultsWithoutSkip.map(r => r.k));
422422

423-
assertTrue([...skipKeys].every(key => withoutSkipKeys.has(key)));
423+
assertTrue([...skipKeys].every(key => withoutSkipKeys.has(key)), "Skip results are not contained within without skip results: " + JSON.stringify(resultsWithSkip) + " " + JSON.stringify(resultsWithoutSkip));
424424
},
425425

426426
testApproxL2Subquery: function() {
@@ -631,11 +631,11 @@ function VectorIndexCosineTestSuite() {
631631

632632
// For cosine similarity the results must be ordered in descending order
633633
for (let j = 1; j < results.length; ++j) {
634-
assertTrue(results[j - 1].sim >= results[j].sim);
634+
assertTrue(results[j - 1].sim >= results[j].sim, "Results are not in descending order: " + JSON.stringify(results));
635635
}
636636
// Assert that distances are in [-1, 1] range
637637
for (let j = 0; j < results.length; ++j) {
638-
assertTrue(Math.abs(results[j].sim) <= 1.01);
638+
assertTrue(Math.abs(results[j].sim) <= 1.01, "Cosine similarity is not in [-1, 1] range: " + JSON.stringify(results));
639639
}
640640
}
641641
},
@@ -787,7 +787,7 @@ function VectorIndexInnerProductTestSuite() {
787787

788788
// For inner product metric the results must be ordered in descending order
789789
for (let j = 1; j < results.length; ++j) {
790-
assertTrue(results[j - 1].sim >= results[j].sim);
790+
assertTrue(results[j - 1].sim >= results[j].sim, "Results are not in descending order: " + JSON.stringify(results));
791791
}
792792
}
793793
},
@@ -835,7 +835,7 @@ function VectorIndexInnerProductTestSuite() {
835835
const skipKeys = new Set(resultsWithSkip.map(r => r.k));
836836
const withoutSkipKeys = new Set(resultsWithoutSkip.map(r => r.k));
837837

838-
assertTrue([...skipKeys].every(key => withoutSkipKeys.has(key)));
838+
assertTrue([...skipKeys].every(key => withoutSkipKeys.has(key)), "Skip results are not contained within without skip results: " + JSON.stringify(resultsWithSkip) + " " + JSON.stringify(resultsWithoutSkip));
839839
},
840840
};
841841
}

0 commit comments

Comments
 (0)
0