From 269c9b9a86f97e53514faa16473ef74ed54b0e51 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Mon, 30 Nov 2020 17:16:12 -0600 Subject: [PATCH] chore(test): use CHECK for multi-value assertions --- test/Matrix.cpp | 64 ++++++++++++++++++++++++------------------------- test/Vector.cpp | 56 +++++++++++++++++++++---------------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/test/Matrix.cpp b/test/Matrix.cpp index 69c6c0e..0fccf8a 100644 --- a/test/Matrix.cpp +++ b/test/Matrix.cpp @@ -46,42 +46,42 @@ TEST_CASE("C44Matrix::RotationAroundZ", "[matrix]") { TEST_CASE("C44Matrix", "[matrix]") { SECTION("constructs with default constructor") { C44Matrix matrix; - REQUIRE(matrix.a0 == 1.0f); - REQUIRE(matrix.a1 == 0.0f); - REQUIRE(matrix.a2 == 0.0f); - REQUIRE(matrix.a3 == 0.0f); - REQUIRE(matrix.b0 == 0.0f); - REQUIRE(matrix.b1 == 1.0f); - REQUIRE(matrix.b2 == 0.0f); - REQUIRE(matrix.b3 == 0.0f); - REQUIRE(matrix.c0 == 0.0f); - REQUIRE(matrix.c1 == 0.0f); - REQUIRE(matrix.c2 == 1.0f); - REQUIRE(matrix.c3 == 0.0f); - REQUIRE(matrix.d0 == 0.0f); - REQUIRE(matrix.d1 == 0.0f); - REQUIRE(matrix.d2 == 0.0f); - REQUIRE(matrix.d3 == 1.0f); + CHECK(matrix.a0 == 1.0f); + CHECK(matrix.a1 == 0.0f); + CHECK(matrix.a2 == 0.0f); + CHECK(matrix.a3 == 0.0f); + CHECK(matrix.b0 == 0.0f); + CHECK(matrix.b1 == 1.0f); + CHECK(matrix.b2 == 0.0f); + CHECK(matrix.b3 == 0.0f); + CHECK(matrix.c0 == 0.0f); + CHECK(matrix.c1 == 0.0f); + CHECK(matrix.c2 == 1.0f); + CHECK(matrix.c3 == 0.0f); + CHECK(matrix.d0 == 0.0f); + CHECK(matrix.d1 == 0.0f); + CHECK(matrix.d2 == 0.0f); + CHECK(matrix.d3 == 1.0f); } SECTION("constructs with element constructor") { auto matrix = C44Matrix(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f); - REQUIRE(matrix.a0 == 1.0f); - REQUIRE(matrix.a1 == 2.0f); - REQUIRE(matrix.a2 == 3.0f); - REQUIRE(matrix.a3 == 4.0f); - REQUIRE(matrix.b0 == 5.0f); - REQUIRE(matrix.b1 == 6.0f); - REQUIRE(matrix.b2 == 7.0f); - REQUIRE(matrix.b3 == 8.0f); - REQUIRE(matrix.c0 == 9.0f); - REQUIRE(matrix.c1 == 10.0f); - REQUIRE(matrix.c2 == 11.0f); - REQUIRE(matrix.c3 == 12.0f); - REQUIRE(matrix.d0 == 13.0f); - REQUIRE(matrix.d1 == 14.0f); - REQUIRE(matrix.d2 == 15.0f); - REQUIRE(matrix.d3 == 16.0f); + CHECK(matrix.a0 == 1.0f); + CHECK(matrix.a1 == 2.0f); + CHECK(matrix.a2 == 3.0f); + CHECK(matrix.a3 == 4.0f); + CHECK(matrix.b0 == 5.0f); + CHECK(matrix.b1 == 6.0f); + CHECK(matrix.b2 == 7.0f); + CHECK(matrix.b3 == 8.0f); + CHECK(matrix.c0 == 9.0f); + CHECK(matrix.c1 == 10.0f); + CHECK(matrix.c2 == 11.0f); + CHECK(matrix.c3 == 12.0f); + CHECK(matrix.d0 == 13.0f); + CHECK(matrix.d1 == 14.0f); + CHECK(matrix.d2 == 15.0f); + CHECK(matrix.d3 == 16.0f); } } diff --git a/test/Vector.cpp b/test/Vector.cpp index 2a2267c..6019f02 100644 --- a/test/Vector.cpp +++ b/test/Vector.cpp @@ -4,30 +4,30 @@ TEST_CASE("C2Vector", "[vector]") { SECTION("constructs with default constructor") { C2Vector vector; - REQUIRE(vector.x == 0.0f); - REQUIRE(vector.y == 0.0f); + CHECK(vector.x == 0.0f); + CHECK(vector.y == 0.0f); } SECTION("constructs with xy constructor") { auto vector = C2Vector(1.0f, 2.0f); - REQUIRE(vector.x == 1.0f); - REQUIRE(vector.y == 2.0f); + CHECK(vector.x == 1.0f); + CHECK(vector.y == 2.0f); } } TEST_CASE("C3Vector", "[vector]") { SECTION("constructs with default constructor") { C3Vector vector; - REQUIRE(vector.x == 0.0f); - REQUIRE(vector.y == 0.0f); - REQUIRE(vector.z == 0.0f); + CHECK(vector.x == 0.0f); + CHECK(vector.y == 0.0f); + CHECK(vector.z == 0.0f); } SECTION("constructs with xyz constructor") { auto vector = C3Vector(1.0f, 2.0f, 3.0f); - REQUIRE(vector.x == 1.0f); - REQUIRE(vector.y == 2.0f); - REQUIRE(vector.z == 3.0f); + CHECK(vector.x == 1.0f); + CHECK(vector.y == 2.0f); + CHECK(vector.z == 3.0f); } } @@ -35,25 +35,25 @@ TEST_CASE("C3Vector::operator*=", "[vector]") { SECTION("multiplies by 2.0f") { auto vector = C3Vector(1.0f, 2.0f, 3.0f); vector *= 2.0f; - REQUIRE(vector.x == 2.0f); - REQUIRE(vector.y == 4.0f); - REQUIRE(vector.z == 6.0f); + CHECK(vector.x == 2.0f); + CHECK(vector.y == 4.0f); + CHECK(vector.z == 6.0f); } SECTION("multiplies by -2.0f") { auto vector = C3Vector(1.0f, 2.0f, 3.0f); vector *= -2.0f; - REQUIRE(vector.x == -2.0f); - REQUIRE(vector.y == -4.0f); - REQUIRE(vector.z == -6.0f); + CHECK(vector.x == -2.0f); + CHECK(vector.y == -4.0f); + CHECK(vector.z == -6.0f); } SECTION("multiplies by 0.0f") { auto vector = C3Vector(1.0f, 2.0f, 3.0f); vector *= 0.0f; - REQUIRE(vector.x == 0.0f); - REQUIRE(vector.y == 0.0f); - REQUIRE(vector.z == 0.0f); + CHECK(vector.x == 0.0f); + CHECK(vector.y == 0.0f); + CHECK(vector.z == 0.0f); } } @@ -78,17 +78,17 @@ TEST_CASE("C3Vector::Normalize", "[vector]") { SECTION("normalizes C3Vector(1.0f, 1.0f, 1.0f)") { auto vector = C3Vector(1.0f, 1.0f, 1.0f); vector.Normalize(); - REQUIRE(vector.x == Approx(0.57735f)); - REQUIRE(vector.y == Approx(0.57735f)); - REQUIRE(vector.z == Approx(0.57735f)); + CHECK(vector.x == Approx(0.57735f)); + CHECK(vector.y == Approx(0.57735f)); + CHECK(vector.z == Approx(0.57735f)); } SECTION("normalizes C3Vector(4.0f, 16.0f, 32.0f)") { auto vector = C3Vector(4.0f, 16.0f, 32.0f); vector.Normalize(); - REQUIRE(vector.x == Approx(0.11111f)); - REQUIRE(vector.y == Approx(0.44444f)); - REQUIRE(vector.z == Approx(0.88888f)); + CHECK(vector.x == Approx(0.11111f)); + CHECK(vector.y == Approx(0.44444f)); + CHECK(vector.z == Approx(0.88888f)); } } @@ -119,9 +119,9 @@ TEST_CASE("C3Vector global operators", "[vector]") { auto vector1 = C3Vector(1.0f, 2.0f, 3.0f); auto vector2 = C3Vector(4.0f, 5.0f, 6.0f); auto vector3 = vector1 + vector2; - REQUIRE(vector3.x == 5.0f); - REQUIRE(vector3.y == 7.0f); - REQUIRE(vector3.z == 9.0f); + CHECK(vector3.x == 5.0f); + CHECK(vector3.y == 7.0f); + CHECK(vector3.z == 9.0f); } SECTION("C3Vector != C3Vector") {