Skip to content

Commit 69c551a

Browse files
committed
🚸 Augment test with text output in failing case
1 parent 8c070dd commit 69c551a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/na/test_namapper.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030

3131
namespace na {
3232
auto validateAODConstraints(const NAComputation& comp) -> bool {
33+
std::size_t counter = 1; // the first operation is `init at ...;`
3334
for (const auto& naOp : comp) {
35+
++counter;
3436
if (naOp->isShuttlingOperation()) {
3537
const auto& shuttlingOp =
3638
dynamic_cast<const NAShuttlingOperation&>(*naOp);
@@ -44,27 +46,35 @@ auto validateAODConstraints(const NAComputation& comp) -> bool {
4446
const auto& e1 = shuttlingOp.getEnd()[i];
4547
const auto& e2 = shuttlingOp.getEnd()[j];
4648
if (*s1 == *s2) {
49+
std::cout << "Error in op number " << counter << " (two start points identical)\n";
4750
return false;
4851
}
4952
if (*e1 == *e2) {
53+
std::cout << "Error in op number " << counter << " (two end points identical)\n";
5054
return false;
5155
}
5256
if (s1->x == s2->x && e1->x != e2->x) {
57+
std::cout << "Error in op number " << counter << " (columns not preserved)\n";
5358
return false;
5459
}
5560
if (s1->y == s2->y && e1->y != e2->y) {
61+
std::cout << "Error in op number " << counter << " (rows not preserved)\n";
5662
return false;
5763
}
5864
if (s1->x < s2->x && e1->x >= e2->x) {
65+
std::cout << "Error in op number " << counter << " (column order not preserved)\n";
5966
return false;
6067
}
6168
if (s1->y < s2->y && e1->y >= e2->y) {
69+
std::cout << "Error in op number " << counter << " (row order not preserved)\n";
6270
return false;
6371
}
6472
if (s1->x > s2->x && e1->x <= e2->x) {
73+
std::cout << "Error in op number " << counter << " (column order not preserved)\n";
6574
return false;
6675
}
6776
if (s1->y > s2->y && e1->y <= e2->y) {
77+
std::cout << "Error in op number " << counter << " (row order not preserved)\n";
6878
return false;
6979
}
7080
}
@@ -76,6 +86,7 @@ auto validateAODConstraints(const NAComputation& comp) -> bool {
7686
const auto& a = localOp.getPositions()[i];
7787
const auto& b = localOp.getPositions()[j];
7888
if (*a == *b) {
89+
std::cout << "Error in op number " << counter << " (identical positions)\n";
7990
return false;
8091
}
8192
}

0 commit comments

Comments
 (0)