Skip to content

Commit

Permalink
Extend Polynomial3 unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Hidalgo <[email protected]>
  • Loading branch information
hidmic committed Mar 23, 2022
1 parent 3f4fadc commit 79d493c
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/Polynomial3_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ TEST(Polynomial3Test, Minimum)
math::Intervald::Open(0., 0.))));
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(1., 2.)), 3.);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-1., 0.)), 0.75);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-3., -2.)), 3);
EXPECT_DOUBLE_EQ(p.Minimum(), 0.75);
}
{
Expand All @@ -108,6 +112,10 @@ TEST(Polynomial3Test, Minimum)
math::Intervald::Open(0., 0.))));
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(1., 2.)), -1.);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-2., -1.)), -5.);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(0., 1.)), 1.);
EXPECT_DOUBLE_EQ(p.Minimum(), -math::INF_D);
}
{
Expand All @@ -117,6 +125,10 @@ TEST(Polynomial3Test, Minimum)
math::Intervald::Open(0., 0.))));
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-1., 1.)), 0.);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-2., -1.)), -5.);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(2., 3.)), 15.);
EXPECT_DOUBLE_EQ(p.Minimum(), -math::INF_D);
}
{
Expand All @@ -125,8 +137,13 @@ TEST(Polynomial3Test, Minimum)
EXPECT_TRUE(std::isnan(p.Minimum(
math::Intervald::Open(0., 0.))));
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-1., 1.)),
0.8873882090776197);
math::Intervald::Open(-1., 1.)), 0.8873882090776197);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-3., -2.)), 15);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(1., 2.)), 3);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(2., 3.)), -5);
EXPECT_DOUBLE_EQ(p.Minimum(), -math::INF_D);
}
{
Expand All @@ -136,6 +153,19 @@ TEST(Polynomial3Test, Minimum)
math::Intervald::Open(0., 0.))));
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-1., 1.)), -3);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(0., 2.)), 1);
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(2., 3.)), 3);
EXPECT_DOUBLE_EQ(p.Minimum(), -math::INF_D);
}
{
const math::Polynomial3d p(
math::Vector4d(1., -4., -2., -1.));
EXPECT_TRUE(std::isnan(p.Minimum(
math::Intervald::Open(0., 0.))));
EXPECT_DOUBLE_EQ(p.Minimum(
math::Intervald::Open(-1., 6.)), -16.051047904897441);
EXPECT_DOUBLE_EQ(p.Minimum(), -math::INF_D);
}
}
Expand Down

0 comments on commit 79d493c

Please sign in to comment.