Skip to content

Commit

Permalink
Added a test case in Vector3_TEST.cc to get the expected behaviour
Browse files Browse the repository at this point in the history
Signed-off-by: Avisheet <[email protected]>
  • Loading branch information
Avisheet committed Feb 22, 2024
1 parent 46ec26e commit 259a340
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Vector3_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -576,3 +576,19 @@ TEST(Vector3dTest, OperatorStreamOut)
stream << std::setprecision(1) << std::fixed << v;
EXPECT_EQ(stream.str(), "0.1 1.2 2.3");
}

TEST(Vector3dTest, OperatorLessThan) {
math::Vector3d vec1(1.0, 2.0, 3.0);
math::Vector3d vec2(1.0, 2.0, 4.0);

// Test the less than operator
EXPECT_TRUE(vec1 < vec2);
EXPECT_FALSE(vec2 < vec1);
EXPECT_FALSE(vec1 < vec1);

// Additional test for asymmetric behavior
math::Vector3d vec3(1.0, 2.0, 2.0);
math::Vector3d vec4(1.0, 2.0, 4.0);
EXPECT_TRUE(vec3 < vec4);
EXPECT_FALSE(vec4 < vec3);
}

0 comments on commit 259a340

Please sign in to comment.