vector2d: row/col assignment (+test), default value in resize

This commit is contained in:
2023-01-16 00:37:58 -05:00
parent 50bd1e9c6e
commit 9aa0262247
2 changed files with 51 additions and 17 deletions

View File

@@ -32,6 +32,22 @@ TEST_CASE("vector2d") {
test_vector.col(3)[4] = 12;
CHECK(test_vector(3,4) == 12);
}
SECTION("by row") {
test_vector.row(4) = {1, 2, 3, 4, 5};
CHECK(test_vector(0,4) == 1);
CHECK(test_vector(1,4) == 2);
CHECK(test_vector(2,4) == 3);
CHECK(test_vector(3,4) == 4);
CHECK(test_vector(4,4) == 5);
}
SECTION("by column") {
test_vector.col(4) = {1, 2, 3, 4, 5};
CHECK(test_vector(4,0) == 1);
CHECK(test_vector(4,1) == 2);
CHECK(test_vector(4,2) == 3);
CHECK(test_vector(4,3) == 4);
CHECK(test_vector(4,4) == 5);
}
}
}