Translated tests for Matrix4x4

This commit is contained in:
Leonetienne 2022-02-11 13:06:43 +01:00
parent 46a355cb3b
commit 56d712a7f2
2 changed files with 1019 additions and 1024 deletions

View File

@ -3,6 +3,8 @@ project(Tests)
set(CMAKE_CXX_STANDARD 17)
add_compile_definitions(_EULE_NO_INTRINSICS_)
include_directories(..)
link_directories(../Eule/cmake-build-debug)
@ -17,6 +19,7 @@ add_executable(Tests
Math__Max.cpp
Math__Min.cpp
Math__Similar.cpp
Matrix4x4.cpp
)
target_link_libraries(Tests Eule)

View File

@ -1,43 +1,33 @@
#include "CppUnitTest.h"
#include "../Eule/Matrix4x4.h"
#include "../Eule/Vector3.h"
#include "Catch2.h"
#include <Eule/Matrix4x4.h>
#include <Eule/Vector3.h>
#include "../_TestingUtilities/HandyMacros.h"
#include <random>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace Eule;
namespace Matrices
{
TEST_CLASS(_Matrix4x4)
{
private:
std::mt19937 rng;
public:
// Constructor
_Matrix4x4()
{
rng = std::mt19937((std::random_device())());
return;
namespace {
static std::mt19937 rng = std::mt19937((std::random_device())());
}
// Tests that a freshly created matrix is an identity matrix
TEST_METHOD(New_Matrix_Is_Identity)
TEST_CASE(__FILE__"/New_Matrix_Is_Identity", "[Matrix4x4]")
{
Matrix4x4 mat;
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
if (i == j)
Assert::AreEqual(1.0, mat[i][j]);
REQUIRE(mat[i][j] == 1.0);
else
Assert::AreEqual(0.0, mat[i][j]);
REQUIRE(mat[i][j] == 0.0);
return;
}
// Test if setting values via array descriptors works
TEST_METHOD(Can_Set_Values_ArrayDescriptor)
TEST_CASE(__FILE__"/Can_Set_Values_ArrayDescriptor", "[Matrix4x4]")
{
Matrix4x4 mat;
mat[0][0] = 1;
@ -59,13 +49,13 @@ namespace Matrices
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual((double)(i * 4 + j + 1), mat[i][j]);
REQUIRE((double)(i * 4 + j + 1) == mat[i][j]);
return;
}
// Tests if setting values via letters works
TEST_METHOD(Can_Set_Values_Letters)
TEST_CASE(__FILE__"/Can_Set_Values_Letters", "[Matrix4x4]")
{
Matrix4x4 mat;
mat.a = 1;
@ -87,13 +77,13 @@ namespace Matrices
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual((double)(i * 4 + j + 1), mat[i][j]);
REQUIRE((double)(i * 4 + j + 1) == mat[i][j]);
return;
}
// Tests if setting values via multiple initializer lists works
TEST_METHOD(Can_Set_Values_Multiple_Initializer_Lists)
TEST_CASE(__FILE__"/Can_Set_Values_Multiple_Initializer_Lists", "[Matrix4x4]")
{
Matrix4x4 mat;
mat[0] = { 1, 2, 3, 4 };
@ -103,13 +93,13 @@ namespace Matrices
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual((double)(i * 4 + j + 1), mat[i][j]);
REQUIRE((double)(i * 4 + j + 1) == mat[i][j]);
return;
}
// Tests if values can be read correctly from the reference variables
TEST_METHOD(Can_Read_Letters)
TEST_CASE(__FILE__"/Can_Read_Letters", "[Matrix4x4]")
{
Matrix4x4 mat;
@ -119,28 +109,28 @@ namespace Matrices
mat[i][j] = (double)(i * 4 + j + 1);
// Check if values can be read
Assert::AreEqual( 1.0, mat.a);
Assert::AreEqual( 2.0, mat.b);
Assert::AreEqual( 3.0, mat.c);
Assert::AreEqual( 4.0, mat.d);
Assert::AreEqual( 5.0, mat.e);
Assert::AreEqual( 6.0, mat.f);
Assert::AreEqual( 7.0, mat.g);
Assert::AreEqual( 8.0, mat.h);
Assert::AreEqual( 9.0, mat.i);
Assert::AreEqual(10.0, mat.j);
Assert::AreEqual(11.0, mat.k);
Assert::AreEqual(12.0, mat.l);
Assert::AreEqual(13.0, mat.m);
Assert::AreEqual(14.0, mat.n);
Assert::AreEqual(15.0, mat.o);
Assert::AreEqual(16.0, mat.p);
REQUIRE(mat.a == 1.0);
REQUIRE(mat.b == 2.0);
REQUIRE(mat.c == 3.0);
REQUIRE(mat.d == 4.0);
REQUIRE(mat.e == 5.0);
REQUIRE(mat.f == 6.0);
REQUIRE(mat.g == 7.0);
REQUIRE(mat.h == 8.0);
REQUIRE(mat.i == 9.0);
REQUIRE(mat.j == 10.0);
REQUIRE(mat.k == 11.0);
REQUIRE(mat.l == 12.0);
REQUIRE(mat.m == 13.0);
REQUIRE(mat.n == 14.0);
REQUIRE(mat.o == 15.0);
REQUIRE(mat.p == 16.0);
return;
}
// Tests if the copy constructor results in the same values as the reference given
TEST_METHOD(CopyConstructor_Equal_Values)
TEST_CASE(__FILE__"/CopyConstructor_Equal_Values", "[Matrix4x4]")
{
Matrix4x4 mat1;
@ -155,13 +145,13 @@ namespace Matrices
// Both equal?
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual(mat1[i][j], mat2[i][j]);
REQUIRE(mat1[i][j] == mat2[i][j]);
return;
}
// Tests if the equals operator results in the same values as the reference given
TEST_METHOD(Copy_Via_Equals_Operator)
TEST_CASE(__FILE__"/Copy_Via_Equals_Operator", "[Matrix4x4]")
{
Matrix4x4 mat1;
@ -176,13 +166,13 @@ namespace Matrices
// Both equal?
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual(mat1[i][j], mat2[i][j]);
REQUIRE(mat1[i][j] == mat2[i][j]);
return;
}
// Tests if the values of a matrix constructed via a copy constructor can be changed without modifying the object copied from
TEST_METHOD(Copy_Is_Independent_CopyConstructor)
TEST_CASE(__FILE__"/Copy_Is_Independent_CopyConstructor", "[Matrix4x4]")
{
Matrix4x4 mat1;
@ -202,18 +192,18 @@ namespace Matrices
// Is mat1 untouched?
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual((double)(i * 4 + j), mat1[i][j]);
REQUIRE((double)(i * 4 + j) == mat1[i][j]);
// Are the values of mat2 correct?
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual((double)(i * 4 + j) * -99, mat2[i][j]);
REQUIRE((double)(i * 4 + j) * -99 == mat2[i][j]);
return;
}
// Tests if the values of a matrix constructed copied via the equals operator can be changed without modifying the object copied from
TEST_METHOD(Copy_Is_Independent_EqualOperator)
TEST_CASE(__FILE__"/Copy_Is_Independent_EqualOperator", "[Matrix4x4]")
{
Matrix4x4 mat1;
@ -233,18 +223,18 @@ namespace Matrices
// Is mat1 untouched?
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual((double)(i * 4 + j), mat1[i][j]);
REQUIRE((double)(i * 4 + j) == mat1[i][j]);
// Are the values of mat2 correct?
for (std::size_t i = 0; i < 4; i++)
for (std::size_t j = 0; j < 4; j++)
Assert::AreEqual((double)(i * 4 + j) * -99, mat2[i][j]);
REQUIRE((double)(i * 4 + j) * -99 == mat2[i][j]);
return;
}
// Tests that copying via operator= works
TEST_METHOD(Copy_Operator)
TEST_CASE(__FILE__"/Copy_Operator", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -263,14 +253,17 @@ namespace Matrices
Matrix4x4 b = a_toCopy;
// Verify
Assert::IsTrue(a == a_toCopy, L"a got destroyed!");
Assert::IsTrue(b == a, L"a does not match b!");
INFO("a got destroyed!");
REQUIRE(a == a_toCopy);
INFO("a does not match b!");
REQUIRE(b == a);
return;
}
// Tests that moving via operator= works
TEST_METHOD(Move_Operator)
TEST_CASE(__FILE__"/Move_Operator", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -285,13 +278,14 @@ namespace Matrices
Matrix4x4 b = std::move(a);
// Verify
Assert::IsTrue(b == a_backup, L"Values don't match!");
INFO("Values don't match!");
REQUIRE(b == a_backup);
return;
}
// Tests if the multiply-equals (*=) operator works as intended
TEST_METHOD(Multiplication_Equals)
TEST_CASE(__FILE__"/Multiplication_Equals", "[Matrix4x4]")
{
// Populate 1
Matrix4x4 mat1;
@ -318,13 +312,13 @@ namespace Matrices
expected[2] = { 5390.0, 2757.0, 2572.0, 20 };
expected[3] = { 0, 0, 0, 1 };
Assert::IsTrue(mat1.v == expected.v);
REQUIRE(mat1.v == expected.v);
return;
}
// Tests if the multiplication operator works as intended
TEST_METHOD(Multiplication)
TEST_CASE(__FILE__"/Multiplication", "[Matrix4x4]")
{
// Populate 1
Matrix4x4 mat1;
@ -350,13 +344,13 @@ namespace Matrices
expected[2] = { 5390.0, 2757.0, 2572.0, 20 };
expected[3] = { 0, 0, 0, 1 };
Assert::IsTrue(mat3.v == expected.v);
REQUIRE(mat3.v == expected.v);
return;
}
// Tests if GetTranslationComponent returns the correct values
TEST_METHOD(GetTranslationComponent)
TEST_CASE(__FILE__"/GetTranslationComponent", "[Matrix4x4]")
{
// Create and populate mat
Matrix4x4 mat;
@ -368,15 +362,15 @@ namespace Matrices
Vector3d translation = mat.GetTranslationComponent();
// Check
Assert::AreEqual(69.0, translation.x);
Assert::AreEqual(32.0, translation.y);
Assert::AreEqual(16.0, translation.z);
REQUIRE(translation.x == 69.0);
REQUIRE(translation.y == 32.0);
REQUIRE(translation.z == 16.0);
return;
}
// Tests if SetTranslationComponent returns the correct values
TEST_METHOD(SetTranslationComponent)
TEST_CASE(__FILE__"/SetTranslationComponent", "[Matrix4x4]")
{
// Create and populate mat
Vector3d translation(69, 32, 16);
@ -386,15 +380,15 @@ namespace Matrices
mat.SetTranslationComponent(translation);
// Check
Assert::AreEqual(69.0, mat.d);
Assert::AreEqual(32.0, mat.h);
Assert::AreEqual(16.0, mat.l);
REQUIRE(mat.d == 69.0);
REQUIRE(mat.h == 32.0);
REQUIRE(mat.l == 16.0);
return;
}
// Tests that transpose3x3 works
TEST_METHOD(Transpose3x3)
TEST_CASE(__FILE__"/Transpose3x3", "[Matrix4x4]")
{
Matrix4x4 m;
m[0] = { 0, 0, 0, 0 };
@ -409,18 +403,18 @@ namespace Matrices
target[3] = { 9, 0, 6, 0 };
// Create debug output
std::wstringstream wss;
wss << std::endl
<< "Actual: " << m.Transpose3x3() << std::endl
<< "Target: " << target << std::endl;
INFO(
"Actual: " << m.Transpose3x3() << '\n'
<< "Target: " << target << '\n'
);
Assert::IsTrue(target == m.Transpose3x3(), wss.str().c_str());
REQUIRE(target == m.Transpose3x3());
return;
}
// Tests that transpose4x4 works
TEST_METHOD(Transpose4x4)
TEST_CASE(__FILE__"/Transpose4x4", "[Matrix4x4]")
{
Matrix4x4 m;
m[0] = { 0, 0, 0, 0 };
@ -435,18 +429,18 @@ namespace Matrices
target[3] = { 0, 0, 5, 0 };
// Create debug output
std::wstringstream wss;
wss << std::endl
<< "Actual: " << m.Transpose4x4() << std::endl
<< "Target: " << target << std::endl;
INFO(
"Actual: " << m.Transpose4x4() << '\n'
<< "Target: " << target << '\n'
);
Assert::IsTrue(target == m.Transpose4x4(), wss.str().c_str());
REQUIRE(target == m.Transpose4x4());
return;
}
// Tests that IsInvertible3x3 works -> true
TEST_METHOD(Is_Invertible_3x3_True)
TEST_CASE(__FILE__"/Is_Invertible_3x3_True", "[Matrix4x4]")
{
Matrix4x4 m;
m[0] = { 0.56601, -0.87207, 0.52783, 488.00000 };
@ -454,13 +448,13 @@ namespace Matrices
m[2] = { -1.09497, -0.66076, -0.15866, -155.09390 };
m[3] = { 0.00000, 0.00000, 0.00000, 0.00000 };
Assert::IsTrue(m.IsInversible3x3());
REQUIRE(m.IsInversible3x3());
return;
}
// Tests that IsInvertible3x3 works -> false
TEST_METHOD(Is_Invertible_3x3_False)
TEST_CASE(__FILE__"/Is_Invertible_3x3_False", "[Matrix4x4]")
{
Matrix4x4 m;
m[0] = { 0, 0, 1, 0 };
@ -468,13 +462,13 @@ namespace Matrices
m[2] = { 0, 0, 0, 0 };
m[3] = { 0, 0, 0, 0 };
Assert::IsFalse(m.IsInversible3x3());
REQUIRE_FALSE(m.IsInversible3x3());
return;
}
// Tests that IsInvertible4x4 works -> true
TEST_METHOD(Is_Invertible_4x4_True)
TEST_CASE(__FILE__"/Is_Invertible_4x4_True", "[Matrix4x4]")
{
Matrix4x4 m;
m[0] = { 0.56601, -0.87207, 0.52783, 488.00000 };
@ -482,13 +476,13 @@ namespace Matrices
m[2] = { -1.09497, -0.66076, -0.15866, -155.09390 };
m[3] = { 0.00000, 0.00000, 0.00000, 1.00000 };
Assert::IsTrue(m.IsInversible4x4());
REQUIRE(m.IsInversible4x4());
return;
}
// Tests that IsInvertible4x4 works -> false
TEST_METHOD(Is_Invertible_4x4_False)
TEST_CASE(__FILE__"/Is_Invertible_4x4_False", "[Matrix4x4]")
{
Matrix4x4 m;
m[0] = { 0.56601, -0.87207, 0.52783, 488.00000 };
@ -496,13 +490,13 @@ namespace Matrices
m[2] = { -1.09497, -0.66076, -0.15866, -155.09390 };
m[3] = { 0.00000, 0.00000, 0.00000, 0.00000 };
Assert::IsFalse(m.IsInversible4x4());
REQUIRE_FALSE(m.IsInversible4x4());
return;
}
// Tests that inverting a 3x3 matrix (scale, rotation, translation) works
TEST_METHOD(Inverse3x3)
TEST_CASE(__FILE__"/Inverse3x3", "[Matrix4x4]")
{
// Invert 50 randomly generated matrices
for (std::size_t i = 0; i < 50;)
@ -519,13 +513,13 @@ namespace Matrices
Matrix4x4 result = m * inv_m;
// Create debug output
std::wstringstream wss;
wss << std::endl
<< "i: " << i << std::endl
<< "Actual: " << result << std::endl
<< "Target: " << Matrix4x4() << std::endl;
INFO(
"i: " << i << '\n'
<< "Actual: " << result << '\n'
<< "Target: " << Matrix4x4() << '\n'
);
Assert::IsTrue(result.Similar(Matrix4x4()), wss.str().c_str()); // Default constructor is identity matrix
REQUIRE(result.Similar(Matrix4x4())); // Default constructor is identity matrix
i++;
}
}
@ -534,7 +528,7 @@ namespace Matrices
}
// Tests that inverting a 4x4 matrix works
TEST_METHOD(Inverse4x4)
TEST_CASE(__FILE__"/Inverse4x4", "[Matrix4x4]")
{
// Invert 50 randomly generated matrices
for (std::size_t i = 0; i < 50;)
@ -550,13 +544,13 @@ namespace Matrices
Matrix4x4 inv_m = m.Inverse4x4();
// Create debug output
std::wstringstream wss;
wss << std::endl
<< "i: " << i << std::endl
<< "Actual: " << m.Multiply4x4(inv_m) << std::endl
<< "Target: " << Matrix4x4() << std::endl;
INFO(
"i: " << i << '\n'
<< "Actual: " << m.Multiply4x4(inv_m) << '\n'
<< "Target: " << Matrix4x4() << '\n'
);
Assert::IsTrue((m.Multiply4x4(inv_m)).Similar(Matrix4x4(), 0.0001), wss.str().c_str()); // Default constructor is identity matrix
REQUIRE((m.Multiply4x4(inv_m)).Similar(Matrix4x4(), 0.0001)); // Default constructor is identity matrix
i++;
}
}
@ -565,7 +559,7 @@ namespace Matrices
}
// Tests the Multiply4x4 method, which does an actual 4x4 multiplication
TEST_METHOD(Multiply4x4)
TEST_CASE(__FILE__"/Multiply4x4", "[Matrix4x4]")
{
Matrix4x4 a;
a[0] = { 0, 1, 2, 3 };
@ -586,16 +580,16 @@ namespace Matrices
e[3] = { 72, 58, 84, 70 };
// Create debug output
std::wstringstream wss;
wss << std::endl
<< "Actual: " << a.Multiply4x4(b) << std::endl
<< "Target: " << e << std::endl;
INFO(
"Actual: " << a.Multiply4x4(b) << '\n'
<< "Target: " << e << '\n'
);
Assert::IsTrue(a.Multiply4x4(b).Similar(e), wss.str().c_str());
REQUIRE(a.Multiply4x4(b).Similar(e));
}
// Tests the DropTranslationComponents method. It should return itself, with d,h,l = 0,0,0
TEST_METHOD(DropTranslationComponents)
TEST_CASE(__FILE__"/DropTranslationComponents", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -611,12 +605,12 @@ namespace Matrices
e[3] = { 2, 3, 4, 5 };
// Exercise, Verify
Assert::IsTrue(e == a.DropTranslationComponents());
REQUIRE(e == a.DropTranslationComponents());
return;
}
//! Tests that adding two matrices works as intended
TEST_METHOD(Operator_Add)
TEST_CASE(__FILE__"/Operator_Add", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -641,13 +635,13 @@ namespace Matrices
Matrix4x4 result = a + b;
// Verify
Assert::IsTrue(exp == result);
REQUIRE(exp == result);
return;
}
//! Tests that adding two matrices works as intended
TEST_METHOD(Operator_AddEquals)
TEST_CASE(__FILE__"/Operator_AddEquals", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -672,13 +666,13 @@ namespace Matrices
a += b;
// Verify
Assert::IsTrue(exp == a);
REQUIRE(exp == a);
return;
}
//! Tests that subtracting two matrices works as intended
TEST_METHOD(Operator_Sub)
TEST_CASE(__FILE__"/Operator_Sub", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -703,13 +697,13 @@ namespace Matrices
Matrix4x4 result = a - b;
// Verify
Assert::IsTrue(exp == result);
REQUIRE(exp == result);
return;
}
//! Tests that subtracting two matrices works as intended
TEST_METHOD(Operator_SubEuqals)
TEST_CASE(__FILE__"/Operator_SubEuqals", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -734,13 +728,13 @@ namespace Matrices
a -= b;
// Verify
Assert::IsTrue(exp == a);
REQUIRE(exp == a);
return;
}
// Tests that the multiplication operator for a double parameter works
TEST_METHOD(Operator_MultiplyDouble)
TEST_CASE(__FILE__"/Operator_MultiplyDouble", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -761,13 +755,13 @@ namespace Matrices
Matrix4x4 result = a * s;
// Verify
Assert::IsTrue(exp.Similar(result));
REQUIRE(exp.Similar(result));
return;
}
// Tests that the multiplication operator for a double parameter works
TEST_METHOD(Operator_MultiplyEqualsDouble)
TEST_CASE(__FILE__"/Operator_MultiplyEqualsDouble", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -788,13 +782,13 @@ namespace Matrices
a *= s;
// Verify
Assert::IsTrue(exp.Similar(a));
REQUIRE(exp.Similar(a));
return;
}
// Tests that the division operator for a double parameter works
TEST_METHOD(Operator_DivideDouble)
TEST_CASE(__FILE__"/Operator_DivideDouble", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -815,13 +809,13 @@ namespace Matrices
Matrix4x4 result = a / s;
// Verify
Assert::IsTrue(exp.Similar(result));
REQUIRE(exp.Similar(result));
return;
}
// Tests that the division operator for a double parameter works
TEST_METHOD(Operator_DivideEqualsDouble)
TEST_CASE(__FILE__"/Operator_DivideEqualsDouble", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -842,13 +836,13 @@ namespace Matrices
a /= s;
// Verify
Assert::IsTrue(exp.Similar(a));
REQUIRE(exp.Similar(a));
return;
}
// Tests that matrix division (multiplication with inverse) works
TEST_METHOD(Operator_DivideMatrix)
TEST_CASE(__FILE__"/Operator_DivideMatrix", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -871,13 +865,13 @@ namespace Matrices
Matrix4x4 actual = a / b;
// Verify
Assert::IsTrue(expected.Similar(actual));
REQUIRE(expected.Similar(actual));
return;
}
// Tests that matrix division (multiplication with inverse) works
TEST_METHOD(Operator_DivideEqualsMatrix)
TEST_CASE(__FILE__"/Operator_DivideEqualsMatrix", "[Matrix4x4]")
{
// Setup
Matrix4x4 a;
@ -900,13 +894,13 @@ namespace Matrices
a /= b;
// Verify
Assert::IsTrue(expected.Similar(a));
REQUIRE(expected.Similar(a));
return;
}
// Tests that Math::Similar() works -> true
TEST_METHOD(Similar_True)
TEST_CASE(__FILE__"/Similar_True", "[Matrix4x4]")
{
Matrix4x4 a;
a[0] = { 1, 0, 0, 0 };
@ -920,11 +914,11 @@ namespace Matrices
b[2] = { -69e-25, 13e-23, 1, 4.301e-15 };
b[3] = { -23e-19, 23e-19, 25e-7, 1 };
Assert::IsTrue(a.Similar(b));
REQUIRE(a.Similar(b));
}
// Tests that Math::Similar() works -> false
TEST_METHOD(Similar_False)
TEST_CASE(__FILE__"/Similar_False", "[Matrix4x4]")
{
Matrix4x4 a;
a[0] = { 1, 0, 0, 0 };
@ -938,11 +932,11 @@ namespace Matrices
b[2] = { -69e-25, 13e-23, 1, 4.301e-15 };
b[3] = { -23e-19, 23e-19, 25e-7, 1 };
Assert::IsFalse(a.Similar(b));
REQUIRE_FALSE(a.Similar(b));
}
// Tests if the equal operator (==) and not-equals operator (!=) work (equal: false)
TEST_METHOD(Operator_Equals_NotEquals_False)
TEST_CASE(__FILE__"/Operator_Equals_NotEquals_False", "[Matrix4x4]")
{
Matrix4x4 a;
a[0] = { 0x0, 0x1, 0x2, 0x3 };
@ -956,13 +950,13 @@ namespace Matrices
b[1] = { 0x7 ,0x5, 0x6, 0x4 };
b[0] = { 0x3 ,0x1, 0x2, 0x0 };
Assert::IsFalse(a == b);
Assert::IsTrue(a != b);
REQUIRE_FALSE(a == b);
REQUIRE(a != b);
return;
}
// Tests if the equal operator (==) and not-equals operator (!=) work (equal: true)
TEST_METHOD(Operator_Equals_False)
TEST_CASE(__FILE__"/Operator_Equals_False", "[Matrix4x4]")
{
Matrix4x4 a;
a[0] = { 0x0, 0x1, 0x2, 0x3 };
@ -976,13 +970,13 @@ namespace Matrices
b[2] = { 0x8, 0x9, 0xA, 0xB };
b[3] = { 0xC, 0xD, 0xE, 0xF };
Assert::IsTrue(a == b);
Assert::IsFalse(a != b);
REQUIRE(a == b);
REQUIRE_FALSE(a != b);
return;
}
// Tests if the equal const operator (==) and not-equals operator (!=) work (equal: false)
TEST_METHOD(Operator_Equals_Const_NotEquals_False)
TEST_CASE(__FILE__"/Operator_Equals_Const_NotEquals_False", "[Matrix4x4]")
{
Matrix4x4 a;
a[0] = { 0x0, 0x1, 0x2, 0x3 };
@ -999,13 +993,13 @@ namespace Matrices
const Matrix4x4 a_const = a;
const Matrix4x4 b_const = b;
Assert::IsFalse(a_const == b_const);
Assert::IsTrue(a_const != b_const);
REQUIRE_FALSE(a_const == b_const);
REQUIRE(a_const != b_const);
return;
}
// Tests if the equal const operator (==) and not-equals operator (!=) work (equal: true)
TEST_METHOD(Operator_Equals_Const_False)
TEST_CASE(__FILE__"/Operator_Equals_Const_False", "[Matrix4x4]")
{
Matrix4x4 a;
a[0] = { 0x0, 0x1, 0x2, 0x3 };
@ -1022,9 +1016,7 @@ namespace Matrices
const Matrix4x4 a_const = a;
const Matrix4x4 b_const = b;
Assert::IsTrue(a_const == b_const);
Assert::IsFalse(a_const != b_const);
REQUIRE(a_const == b_const);
REQUIRE_FALSE(a_const != b_const);
return;
}
};
}