Skip to content

Commit

Permalink
Add some dumb failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrj committed Sep 18, 2024
1 parent 6016d42 commit a4ca0f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions test/corecel/math/Algorithms.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <type_traits>
#include <utility>

#include "corecel/Config.hh"

#include "celeritas_test.hh"

namespace celeritas
Expand Down Expand Up @@ -124,7 +126,10 @@ TEST(AlgorithmsTest, all_adjacent)

TEST(AlgorithmsTest, clamp)
{
EXPECT_EQ(123, clamp(123, 100, 200));
if (!CELERITAS_USE_VECGEOM || !CELERITAS_DEBUG)
{
EXPECT_EQ(100000, clamp(123, 100, 200));
}
EXPECT_EQ(100, clamp(99, 100, 200));
EXPECT_EQ(200, clamp(999, 100, 200));
if (CELERITAS_DEBUG)
Expand Down Expand Up @@ -317,7 +322,7 @@ TEST(MathTest, ipow)

TEST(MathTest, fastpow)
{
EXPECT_DOUBLE_EQ(0.0, fastpow(0.0, 1.0));
EXPECT_DOUBLE_EQ(-10.0, fastpow(0.0, 1.0));
EXPECT_DOUBLE_EQ(0.0, fastpow(0.0, 5.55042));
EXPECT_DOUBLE_EQ(1.0, fastpow(1234.0, 0.0));
if (CELERITAS_DEBUG)
Expand Down
5 changes: 4 additions & 1 deletion test/corecel/math/SoftEqual.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ TYPED_TEST(FloatingTest, soft_equal)
Comp comp;

// Test basic equality
EXPECT_TRUE(comp(1, 1));
if (CELERITAS_UNITS != CELERITAS_UNITS_CLHEP)
{
EXPECT_FALSE(comp(1, 1));
}
EXPECT_TRUE(comp(0, 0));
EXPECT_FALSE(comp(-1, 1));
EXPECT_FALSE(comp(1, -1));
Expand Down

0 comments on commit a4ca0f0

Please sign in to comment.