feat(vector): add operator!= for C3Vector and C3Vector

This commit is contained in:
fallenoak 2020-11-26 11:41:04 -06:00
parent ee4612182a
commit 6f82ab3561
No known key found for this signature in database
GPG key ID: 7628F8E61AEA070D
3 changed files with 12 additions and 0 deletions

View file

@ -28,3 +28,7 @@ C3Vector operator+(const C3Vector& l, const C3Vector& r) {
return { x, y, z };
}
bool operator!=(const C3Vector& l, const C3Vector& r) {
return l.x != r.x || l.y != r.y || l.z != r.z;
}

View file

@ -22,4 +22,6 @@ class C3Vector {
C3Vector operator+(const C3Vector& l, const C3Vector& r);
bool operator!=(const C3Vector& l, const C3Vector& r);
#endif

View file

@ -109,4 +109,10 @@ TEST_CASE("C3Vector global operators", "[vector]") {
REQUIRE(vector3.y == 7.0f);
REQUIRE(vector3.z == 9.0f);
}
SECTION("C3Vector != C3Vector") {
auto vector1 = C3Vector(1.0f, 2.0f, 3.0f);
auto vector2 = C3Vector(4.0f, 5.0f, 6.0f);
REQUIRE(vector1 != vector2);
}
}