Skip to content

Commit

Permalink
Add tests to increase test coverage (#533)
Browse files Browse the repository at this point in the history
Signed-off-by: Bi0T1N <[email protected]>
Co-authored-by: Bi0T1N <[email protected]>
  • Loading branch information
Bi0T1N and Bi0T1N authored May 8, 2023
1 parent 836a5c5 commit 2dd5ab6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Color_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ TEST(Color, Color)
EXPECT_FLOAT_EQ(0.0f, clr0.B());
EXPECT_FLOAT_EQ(1.0f, clr0.A());
EXPECT_EQ(clr0.AsRGBA(), 255u);

auto clrcpy = math::Color(clr0);
EXPECT_FLOAT_EQ(0.0f, clrcpy.R());
EXPECT_FLOAT_EQ(0.0f, clrcpy.G());
EXPECT_FLOAT_EQ(0.0f, clrcpy.B());
EXPECT_FLOAT_EQ(1.0f, clrcpy.A());
EXPECT_EQ(clrcpy.AsRGBA(), 255u);

clr0.A(0.0);
EXPECT_EQ(clr0.AsRGBA(), 0u);

Expand Down Expand Up @@ -256,6 +264,12 @@ TEST(Color, Color)
EXPECT_TRUE(math::equal(0.1f, clr.G()));
EXPECT_TRUE(math::equal(0.2f, clr.B()));
EXPECT_TRUE(math::equal(0.3f, clr.A()));

clrcpy = math::Color(clr);
EXPECT_TRUE(math::equal(0.25f, clrcpy.R()));
EXPECT_TRUE(math::equal(0.1f, clrcpy.G()));
EXPECT_TRUE(math::equal(0.2f, clrcpy.B()));
EXPECT_TRUE(math::equal(0.3f, clrcpy.A()));
}


Expand Down
7 changes: 7 additions & 0 deletions src/Material_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ TEST(MaterialTest, Accessors)
EXPECT_TRUE(mat.Name().empty());
}

{
Material mat("wood");
EXPECT_FALSE(mat.Name().empty());
mat.SetName("MyWood");
EXPECT_EQ("MyWood", mat.Name());
}

{
Material material;
material.SetToNearestDensity(19300.0);
Expand Down

0 comments on commit 2dd5ab6

Please sign in to comment.