-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test cases for min and max edge cases
- Loading branch information
1 parent
bee36c5
commit e936992
Showing
3 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "gtest/gtest.h" | ||
#include <array> | ||
#include <autoppl/math/math.hpp> | ||
|
||
namespace ppl { | ||
namespace math { | ||
|
||
struct math_fixture : ::testing::Test | ||
{ | ||
protected: | ||
std::array<double, 3> x = {0}; | ||
}; | ||
|
||
TEST_F(math_fixture, min_edge_case) | ||
{ | ||
auto res = min(x.end(), x.begin()); | ||
EXPECT_DOUBLE_EQ(res, inf<double>); | ||
} | ||
|
||
TEST_F(math_fixture, max_edge_case) | ||
{ | ||
auto res = max(x.end(), x.begin()); | ||
EXPECT_DOUBLE_EQ(res, neg_inf<double>); | ||
} | ||
|
||
} // namespace math | ||
} // namespace ppl |