Implement snappedi, snappedf, and Vector[2/3/4]i.snapped
This commit is contained in:
parent
a1bc636098
commit
e26f0906f2
18 changed files with 222 additions and 40 deletions
|
|
@ -131,12 +131,16 @@ TEST_CASE("[Vector2i] Other methods") {
|
|||
"Vector2i aspect should work as expected.");
|
||||
|
||||
CHECK_MESSAGE(
|
||||
Vector2i(1, 2) == vector.min(Vector2i(3, 2)),
|
||||
vector.min(Vector2i(3, 2)) == Vector2i(1, 2),
|
||||
"Vector2i min should return expected value.");
|
||||
|
||||
CHECK_MESSAGE(
|
||||
Vector2i(5, 3) == vector.max(Vector2i(5, 2)),
|
||||
vector.max(Vector2i(5, 2)) == Vector2i(5, 3),
|
||||
"Vector2i max should return expected value.");
|
||||
|
||||
CHECK_MESSAGE(
|
||||
vector.snapped(Vector2i(4, 2)) == Vector2i(0, 4),
|
||||
"Vector2i snapped should work as expected.");
|
||||
}
|
||||
|
||||
TEST_CASE("[Vector2i] Abs and sign methods") {
|
||||
|
|
|
|||
|
|
@ -127,6 +127,14 @@ TEST_CASE("[Vector3i] Operators") {
|
|||
"Vector3i constructed from Vector3 should work as expected.");
|
||||
}
|
||||
|
||||
TEST_CASE("[Vector3i] Other methods") {
|
||||
const Vector3i vector = Vector3i(1, 3, -7);
|
||||
|
||||
CHECK_MESSAGE(
|
||||
vector.snapped(Vector3i(4, 2, 5)) == Vector3i(0, 4, -5),
|
||||
"Vector3i snapped should work as expected.");
|
||||
}
|
||||
|
||||
TEST_CASE("[Vector3i] Abs and sign methods") {
|
||||
const Vector3i vector1 = Vector3i(1, 3, 5);
|
||||
const Vector3i vector2 = Vector3i(1, -3, -5);
|
||||
|
|
|
|||
|
|
@ -130,6 +130,14 @@ TEST_CASE("[Vector4i] Operators") {
|
|||
"Vector4i constructed from Vector4 should work as expected.");
|
||||
}
|
||||
|
||||
TEST_CASE("[Vector3i] Other methods") {
|
||||
const Vector4i vector = Vector4i(1, 3, -7, 13);
|
||||
|
||||
CHECK_MESSAGE(
|
||||
vector.snapped(Vector4i(4, 2, 5, 8)) == Vector4i(0, 4, -5, 16),
|
||||
"Vector4i snapped should work as expected.");
|
||||
}
|
||||
|
||||
TEST_CASE("[Vector4i] Abs and sign methods") {
|
||||
const Vector4i vector1 = Vector4i(1, 3, 5, 7);
|
||||
const Vector4i vector2 = Vector4i(1, -3, -5, 7);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue