From 4f23d0cda8facaa301532131f7d84c68cb7d3ff4 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Mon, 12 Sep 2016 12:50:13 -0700 Subject: [core] - move wrap test (#6311) --- test/math/wrap.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/math/wrap.cpp (limited to 'test/math') diff --git a/test/math/wrap.cpp b/test/math/wrap.cpp new file mode 100644 index 0000000000..9ec1c6ef0c --- /dev/null +++ b/test/math/wrap.cpp @@ -0,0 +1,26 @@ +#include + +#include +#include + +using namespace mbgl; + +TEST(Math, WrapHigherValue) { + ASSERT_DOUBLE_EQ(4.0, util::wrap(16.0, 0.0, 12.0)); +} + +TEST(Math, WrapLowerValue) { + ASSERT_DOUBLE_EQ(9.0, util::wrap(-3.0, 0.0, 12.0)); +} + +TEST(Math, WrapInRangeValue) { + ASSERT_DOUBLE_EQ(4.0, util::wrap(4.0, 0.0, 12.0)); +} + +TEST(Math, WrapMaxValue) { + ASSERT_DOUBLE_EQ(0.0, util::wrap(12.0, 0.0, 12.0)); +} + +TEST(Math, WrapMinValue) { + ASSERT_DOUBLE_EQ(0.0, util::wrap(0.0, 0.0, 12.0)); +} \ No newline at end of file -- cgit v1.2.1