Skip to content

Commit

Permalink
add unit test for == and != (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
petiaccja authored Jun 16, 2024
1 parent 7d9d336 commit 975363b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/TestVector/TestVectorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ using Catch::Approx;


using TypeListReal = TestTypeList<TypesReal, PackedAll>;
using TypeListAll = TestTypeList<TypesAll, PackedAll>;


TEST_CASE("Vector deterministic default initializer", "[Init]") {
Expand Down Expand Up @@ -364,6 +365,32 @@ TEMPLATE_LIST_TEST_CASE("Vector - Swizzle", "[Vector]", TypeListReal) {
}


TEMPLATE_LIST_TEST_CASE("Vector - Comparison", "[Vector]", TypeListAll) {
SECTION(TestType::Name()) {
using Vec3 = typename TestType::template Vector<3>;
using Vec5 = typename TestType::template Vector<5>;

Vec3 value3(1, 2, 3);
Vec3 equal3(1, 2, 3);
Vec3 unequal3(1, 2, 10);

REQUIRE(value3 == equal3);
REQUIRE(!(value3 == unequal3));
REQUIRE(!(value3 != equal3));
REQUIRE(value3 != unequal3);

Vec5 value5(1, 2, 3, 4, 5);
Vec5 equal5(1, 2, 3, 4, 5);
Vec5 unequal5(1, 2, 3, 4, 10);

REQUIRE(value5 == equal5);
REQUIRE(!(value5 == unequal5));
REQUIRE(value5 != unequal5);
REQUIRE(!(value5 != equal5));
}
}


TEST_CASE("Vector - IOParse", "[Vector]") {
Vector<float, 3> parsed;

Expand Down

0 comments on commit 975363b

Please sign in to comment.