Skip to content

Commit

Permalink
Improved the cspan equality test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyge Lovset committed Oct 25, 2024
1 parent cae60f3 commit 82442dc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion misc/tests/cspan_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,15 @@ TEST(cspan, equality) {

//puts(""); cspan_print(Span2, cspan_slice(Span2, &base2, {0, 3}, {1, 4}), "%d");

EXPECT_TRUE(Span2_equals(test2, cspan_slice(Span2, &base2, {0, 3}, {1, 4})));
// Test every 3x3 subtile in base2 against the test2 tile.
c_forrange (y, base2.shape[0] - 3 + 1) {
c_forrange (x, base2.shape[1] - 3 + 1) {
bool expect_eq = (y == 0 && x == 1) || (y == 3 && x == 2);
EXPECT_EQ(expect_eq, Span2_equals(test2, cspan_slice(Span2, &base2, {y, y+3}, {x, x+3})));
}
}

// Check that the two 3x4 tiles are equal.
EXPECT_TRUE(Span2_equals(cspan_slice(Span2, &base2, {0, 3}, {0, 4}),
cspan_slice(Span2, &base2, {3, 6}, {1, 5})));
}
Expand Down

0 comments on commit 82442dc

Please sign in to comment.