diff options
author | max-001 <maxsmits21@kpnmail.nl> | 2024-11-22 08:59:35 +0100 |
---|---|---|
committer | max-001 <maxsmits21@kpnmail.nl> | 2024-11-22 08:59:35 +0100 |
commit | 3965297b579351745c0f5c87aa12829f707c98fd (patch) | |
tree | ee37b28e4319dbbabd4ffefd1ebaa2f0d4405cee | |
parent | a7e39f06b034b6f174997a0f62d93d47fbd64ad9 (diff) |
Replaced EXPECT_EQ with EXPECT_FLOAT_EQ for double and float
-rw-r--r-- | src/test/Vector2Test.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/src/test/Vector2Test.cpp b/src/test/Vector2Test.cpp index d5fcb8a..17bca41 100644 --- a/src/test/Vector2Test.cpp +++ b/src/test/Vector2Test.cpp @@ -33,16 +33,16 @@ TEST_F(Vector2Test, Subtract) { EXPECT_EQ(result.y, -2); Vector2<double> result2 = double_vec1 - double_vec2; - EXPECT_EQ(result2.x, -2.0); - EXPECT_EQ(result2.y, -2.0); + EXPECT_FLOAT_EQ(result2.x, -2.0); + EXPECT_FLOAT_EQ(result2.y, -2.0); Vector2<long> result3 = long_vec1 - long_vec2; EXPECT_EQ(result3.x, -2); EXPECT_EQ(result3.y, -2); Vector2<float> result4 = float_vec1 - float_vec2; - EXPECT_EQ(result4.x, -2.0f); - EXPECT_EQ(result4.y, -2.0f); + EXPECT_FLOAT_EQ(result4.x, -2.0f); + EXPECT_FLOAT_EQ(result4.y, -2.0f); } TEST_F(Vector2Test, SubtractScalar) { @@ -51,16 +51,16 @@ TEST_F(Vector2Test, SubtractScalar) { EXPECT_EQ(result.y, 1); Vector2<double> result2 = double_vec1 - 1.0; - EXPECT_EQ(result2.x, 0.0); - EXPECT_EQ(result2.y, 1.0); + EXPECT_FLOAT_EQ(result2.x, 0.0); + EXPECT_FLOAT_EQ(result2.y, 1.0); Vector2<long> result3 = long_vec1 - 1; EXPECT_EQ(result3.x, 0); EXPECT_EQ(result3.y, 1); Vector2<float> result4 = float_vec1 - 1.0f; - EXPECT_EQ(result4.x, 0.0f); - EXPECT_EQ(result4.y, 1.0f); + EXPECT_FLOAT_EQ(result4.x, 0.0f); + EXPECT_FLOAT_EQ(result4.y, 1.0f); } TEST_F(Vector2Test, Add) { @@ -69,16 +69,16 @@ TEST_F(Vector2Test, Add) { EXPECT_EQ(result.y, 6); Vector2<double> result2 = double_vec1 + double_vec2; - EXPECT_EQ(result2.x, 4.0); - EXPECT_EQ(result2.y, 6.0); + EXPECT_FLOAT_EQ(result2.x, 4.0); + EXPECT_FLOAT_EQ(result2.y, 6.0); Vector2<long> result3 = long_vec1 + long_vec2; EXPECT_EQ(result3.x, 4); EXPECT_EQ(result3.y, 6); Vector2<float> result4 = float_vec1 + float_vec2; - EXPECT_EQ(result4.x, 4.0f); - EXPECT_EQ(result4.y, 6.0f); + EXPECT_FLOAT_EQ(result4.x, 4.0f); + EXPECT_FLOAT_EQ(result4.y, 6.0f); } TEST_F(Vector2Test, AddScalar) { @@ -87,16 +87,16 @@ TEST_F(Vector2Test, AddScalar) { EXPECT_EQ(result.y, 3); Vector2<double> result2 = double_vec1 + 1.0; - EXPECT_EQ(result2.x, 2.0); - EXPECT_EQ(result2.y, 3.0); + EXPECT_FLOAT_EQ(result2.x, 2.0); + EXPECT_FLOAT_EQ(result2.y, 3.0); Vector2<long> result3 = long_vec1 + 1; EXPECT_EQ(result3.x, 2); EXPECT_EQ(result3.y, 3); Vector2<float> result4 = float_vec1 + 1.0f; - EXPECT_EQ(result4.x, 2.0f); - EXPECT_EQ(result4.y, 3.0f); + EXPECT_FLOAT_EQ(result4.x, 2.0f); + EXPECT_FLOAT_EQ(result4.y, 3.0f); } TEST_F(Vector2Test, Multiply) { @@ -105,16 +105,16 @@ TEST_F(Vector2Test, Multiply) { EXPECT_EQ(result.y, 8); Vector2<double> result2 = double_vec1 * double_vec2; - EXPECT_EQ(result2.x, 3.0); - EXPECT_EQ(result2.y, 8.0); + EXPECT_FLOAT_EQ(result2.x, 3.0); + EXPECT_FLOAT_EQ(result2.y, 8.0); Vector2<long> result3 = long_vec1 * long_vec2; EXPECT_EQ(result3.x, 3); EXPECT_EQ(result3.y, 8); Vector2<float> result4 = float_vec1 * float_vec2; - EXPECT_EQ(result4.x, 3.0f); - EXPECT_EQ(result4.y, 8.0f); + EXPECT_FLOAT_EQ(result4.x, 3.0f); + EXPECT_FLOAT_EQ(result4.y, 8.0f); } TEST_F(Vector2Test, MultiplyScalar) { @@ -123,16 +123,16 @@ TEST_F(Vector2Test, MultiplyScalar) { EXPECT_EQ(result.y, 4); Vector2<double> result2 = double_vec1 * 2.0; - EXPECT_EQ(result2.x, 2.0); - EXPECT_EQ(result2.y, 4.0); + EXPECT_FLOAT_EQ(result2.x, 2.0); + EXPECT_FLOAT_EQ(result2.y, 4.0); Vector2<long> result3 = long_vec1 * 2; EXPECT_EQ(result3.x, 2); EXPECT_EQ(result3.y, 4); Vector2<float> result4 = float_vec1 * 2.0f; - EXPECT_EQ(result4.x, 2.0f); - EXPECT_EQ(result4.y, 4.0f); + EXPECT_FLOAT_EQ(result4.x, 2.0f); + EXPECT_FLOAT_EQ(result4.y, 4.0f); } TEST_F(Vector2Test, Divide) { @@ -141,16 +141,16 @@ TEST_F(Vector2Test, Divide) { EXPECT_EQ(result.y, 0); Vector2<double> result2 = double_vec1 / double_vec2; - EXPECT_EQ(result2.x, 0.33333333333333331); - EXPECT_EQ(result2.y, 0.5); + EXPECT_FLOAT_EQ(result2.x, 0.33333333333333331); + EXPECT_FLOAT_EQ(result2.y, 0.5); Vector2<long> result3 = long_vec1 / long_vec2; EXPECT_EQ(result3.x, 0); EXPECT_EQ(result3.y, 0); Vector2<float> result4 = float_vec1 / float_vec2; - EXPECT_EQ(result4.x, 0.333333343f); - EXPECT_EQ(result4.y, 0.5f); + EXPECT_FLOAT_EQ(result4.x, 0.333333343f); + EXPECT_FLOAT_EQ(result4.y, 0.5f); } TEST_F(Vector2Test, DivideScalar) { @@ -159,16 +159,16 @@ TEST_F(Vector2Test, DivideScalar) { EXPECT_EQ(result.y, 1); Vector2<double> result2 = double_vec1 / 2.0; - EXPECT_EQ(result2.x, 0.5); - EXPECT_EQ(result2.y, 1.0); + EXPECT_FLOAT_EQ(result2.x, 0.5); + EXPECT_FLOAT_EQ(result2.y, 1.0); Vector2<long> result3 = long_vec1 / 2; EXPECT_EQ(result3.x, 0); EXPECT_EQ(result3.y, 1); Vector2<float> result4 = float_vec1 / 2.0f; - EXPECT_EQ(result4.x, 0.5f); - EXPECT_EQ(result4.y, 1.0f); + EXPECT_FLOAT_EQ(result4.x, 0.5f); + EXPECT_FLOAT_EQ(result4.y, 1.0f); } TEST_F(Vector2Test, AddChain) { @@ -179,8 +179,8 @@ TEST_F(Vector2Test, AddChain) { Vector2<double> result2 = double_vec1; result2 += double_vec2; - EXPECT_EQ(result2.x, 4.0); - EXPECT_EQ(result2.y, 6.0); + EXPECT_FLOAT_EQ(result2.x, 4.0); + EXPECT_FLOAT_EQ(result2.y, 6.0); Vector2<long> result3 = long_vec1; result3 += long_vec2; @@ -189,8 +189,8 @@ TEST_F(Vector2Test, AddChain) { Vector2<float> result4 = float_vec1; result4 += float_vec2; - EXPECT_EQ(result4.x, 4.0f); - EXPECT_EQ(result4.y, 6.0f); + EXPECT_FLOAT_EQ(result4.x, 4.0f); + EXPECT_FLOAT_EQ(result4.y, 6.0f); } TEST_F(Vector2Test, AddScalarChain) { @@ -201,8 +201,8 @@ TEST_F(Vector2Test, AddScalarChain) { Vector2<double> result2 = double_vec1; result2 += 1.0; - EXPECT_EQ(result2.x, 2.0); - EXPECT_EQ(result2.y, 3.0); + EXPECT_FLOAT_EQ(result2.x, 2.0); + EXPECT_FLOAT_EQ(result2.y, 3.0); Vector2<long> result3 = long_vec1; result3 += 1; @@ -211,8 +211,8 @@ TEST_F(Vector2Test, AddScalarChain) { Vector2<float> result4 = float_vec1; result4 += 1.0f; - EXPECT_EQ(result4.x, 2.0f); - EXPECT_EQ(result4.y, 3.0f); + EXPECT_FLOAT_EQ(result4.x, 2.0f); + EXPECT_FLOAT_EQ(result4.y, 3.0f); } TEST_F(Vector2Test, SubtractChain) { @@ -223,8 +223,8 @@ TEST_F(Vector2Test, SubtractChain) { Vector2<double> result2 = double_vec1; result2 -= double_vec2; - EXPECT_EQ(result2.x, -2.0); - EXPECT_EQ(result2.y, -2.0); + EXPECT_FLOAT_EQ(result2.x, -2.0); + EXPECT_FLOAT_EQ(result2.y, -2.0); Vector2<long> result3 = long_vec1; result3 -= long_vec2; @@ -233,8 +233,8 @@ TEST_F(Vector2Test, SubtractChain) { Vector2<float> result4 = float_vec1; result4 -= float_vec2; - EXPECT_EQ(result4.x, -2.0f); - EXPECT_EQ(result4.y, -2.0f); + EXPECT_FLOAT_EQ(result4.x, -2.0f); + EXPECT_FLOAT_EQ(result4.y, -2.0f); } TEST_F(Vector2Test, SubtractScalarChain) { @@ -245,8 +245,8 @@ TEST_F(Vector2Test, SubtractScalarChain) { Vector2<double> result2 = double_vec1; result2 -= 1.0; - EXPECT_EQ(result2.x, 0.0); - EXPECT_EQ(result2.y, 1.0); + EXPECT_FLOAT_EQ(result2.x, 0.0); + EXPECT_FLOAT_EQ(result2.y, 1.0); Vector2<long> result3 = long_vec1; result3 -= 1; @@ -255,8 +255,8 @@ TEST_F(Vector2Test, SubtractScalarChain) { Vector2<float> result4 = float_vec1; result4 -= 1.0f; - EXPECT_EQ(result4.x, 0.0f); - EXPECT_EQ(result4.y, 1.0f); + EXPECT_FLOAT_EQ(result4.x, 0.0f); + EXPECT_FLOAT_EQ(result4.y, 1.0f); } TEST_F(Vector2Test, MultiplyChain) { @@ -267,8 +267,8 @@ TEST_F(Vector2Test, MultiplyChain) { Vector2<double> result2 = double_vec1; result2 *= double_vec2; - EXPECT_EQ(result2.x, 3.0); - EXPECT_EQ(result2.y, 8.0); + EXPECT_FLOAT_EQ(result2.x, 3.0); + EXPECT_FLOAT_EQ(result2.y, 8.0); Vector2<long> result3 = long_vec1; result3 *= long_vec2; @@ -277,8 +277,8 @@ TEST_F(Vector2Test, MultiplyChain) { Vector2<float> result4 = float_vec1; result4 *= float_vec2; - EXPECT_EQ(result4.x, 3.0f); - EXPECT_EQ(result4.y, 8.0f); + EXPECT_FLOAT_EQ(result4.x, 3.0f); + EXPECT_FLOAT_EQ(result4.y, 8.0f); } TEST_F(Vector2Test, MultiplyScalarChain) { @@ -289,8 +289,8 @@ TEST_F(Vector2Test, MultiplyScalarChain) { Vector2<double> result2 = double_vec1; result2 *= 2.0; - EXPECT_EQ(result2.x, 2.0); - EXPECT_EQ(result2.y, 4.0); + EXPECT_FLOAT_EQ(result2.x, 2.0); + EXPECT_FLOAT_EQ(result2.y, 4.0); Vector2<long> result3 = long_vec1; result3 *= 2; @@ -299,8 +299,8 @@ TEST_F(Vector2Test, MultiplyScalarChain) { Vector2<float> result4 = float_vec1; result4 *= 2.0f; - EXPECT_EQ(result4.x, 2.0f); - EXPECT_EQ(result4.y, 4.0f); + EXPECT_FLOAT_EQ(result4.x, 2.0f); + EXPECT_FLOAT_EQ(result4.y, 4.0f); } TEST_F(Vector2Test, DivideChain) { @@ -311,8 +311,8 @@ TEST_F(Vector2Test, DivideChain) { Vector2<double> result2 = double_vec1; result2 /= double_vec2; - EXPECT_EQ(result2.x, 0.33333333333333331); - EXPECT_EQ(result2.y, 0.5); + EXPECT_FLOAT_EQ(result2.x, 0.33333333333333331); + EXPECT_FLOAT_EQ(result2.y, 0.5); Vector2<long> result3 = long_vec1; result3 /= long_vec2; @@ -321,8 +321,8 @@ TEST_F(Vector2Test, DivideChain) { Vector2<float> result4 = float_vec1; result4 /= float_vec2; - EXPECT_EQ(result4.x, 0.333333343f); - EXPECT_EQ(result4.y, 0.5f); + EXPECT_FLOAT_EQ(result4.x, 0.333333343f); + EXPECT_FLOAT_EQ(result4.y, 0.5f); } TEST_F(Vector2Test, DivideScalarChain) { @@ -333,8 +333,8 @@ TEST_F(Vector2Test, DivideScalarChain) { Vector2<double> result2 = double_vec1; result2 /= 2.0; - EXPECT_EQ(result2.x, 0.5); - EXPECT_EQ(result2.y, 1.0); + EXPECT_FLOAT_EQ(result2.x, 0.5); + EXPECT_FLOAT_EQ(result2.y, 1.0); Vector2<long> result3 = long_vec1; result3 /= 2; @@ -343,8 +343,8 @@ TEST_F(Vector2Test, DivideScalarChain) { Vector2<float> result4 = float_vec1; result4 /= 2.0f; - EXPECT_EQ(result4.x, 0.5f); - EXPECT_EQ(result4.y, 1.0f); + EXPECT_FLOAT_EQ(result4.x, 0.5f); + EXPECT_FLOAT_EQ(result4.y, 1.0f); } TEST_F(Vector2Test, Negatation) { @@ -353,16 +353,16 @@ TEST_F(Vector2Test, Negatation) { EXPECT_EQ(result.y, -2); Vector2<double> result2 = -double_vec1; - EXPECT_EQ(result2.x, -1.0); - EXPECT_EQ(result2.y, -2.0); + EXPECT_FLOAT_EQ(result2.x, -1.0); + EXPECT_FLOAT_EQ(result2.y, -2.0); Vector2<long> result3 = -long_vec1; EXPECT_EQ(result3.x, -1); EXPECT_EQ(result3.y, -2); Vector2<float> result4 = -float_vec1; - EXPECT_EQ(result4.x, -1.0f); - EXPECT_EQ(result4.y, -2.0f); + EXPECT_FLOAT_EQ(result4.x, -1.0f); + EXPECT_FLOAT_EQ(result4.y, -2.0f); } TEST_F(Vector2Test, Equals) { |