summaryrefslogtreecommitdiff
path: root/test/math/wrap.test.cpp
blob: 5610257a5c8725474732debbfbb2fd0359f04640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <mbgl/test/util.hpp>

#include <mbgl/util/constants.hpp>
#include <mbgl/math/wrap.hpp>

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));
}