diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-11-03 13:51:27 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-11-06 10:38:47 -0800 |
commit | 7de4ce5bcbd8a3081f364bef3249d99f3fad60cc (patch) | |
tree | 36eb1fc1c998d58ba51d081db83c43e03cbc19ff /test | |
parent | 5ef5d0886731a800128e5200b4f5bb45708d2b27 (diff) | |
download | qtlocation-mapboxgl-7de4ce5bcbd8a3081f364bef3249d99f3fad60cc.tar.gz |
[core] Simplify Function
Diffstat (limited to 'test')
-rw-r--r-- | test/miscellaneous/functions.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/test/miscellaneous/functions.cpp b/test/miscellaneous/functions.cpp index a82152fae6..5772cfe450 100644 --- a/test/miscellaneous/functions.cpp +++ b/test/miscellaneous/functions.cpp @@ -1,25 +1,26 @@ #include <iostream> #include "../fixtures/util.hpp" -#include <mbgl/style/function_properties.hpp> +#include <mbgl/style/function.hpp> +#include <mbgl/style/style_calculation_parameters.hpp> using namespace mbgl; TEST(Function, Constant) { - EXPECT_EQ(2.0f, mbgl::ConstantFunction<float>(2).evaluate(0)); - EXPECT_EQ(3.8f, mbgl::ConstantFunction<float>(3.8).evaluate(0)); - EXPECT_EQ(22.0f, mbgl::ConstantFunction<float>(22).evaluate(0)); - EXPECT_EQ(2.0f, mbgl::ConstantFunction<float>(2).evaluate(4)); - EXPECT_EQ(3.8f, mbgl::ConstantFunction<float>(3.8).evaluate(4)); - EXPECT_EQ(22.0f, mbgl::ConstantFunction<float>(22).evaluate(4)); - EXPECT_EQ(2.0f, mbgl::ConstantFunction<float>(2).evaluate(22)); - EXPECT_EQ(3.8f, mbgl::ConstantFunction<float>(3.8).evaluate(22)); - EXPECT_EQ(22.0f, mbgl::ConstantFunction<float>(22).evaluate(22)); + EXPECT_EQ(2.0f, mbgl::Function<float>(2).evaluate(0)); + EXPECT_EQ(3.8f, mbgl::Function<float>(3.8).evaluate(0)); + EXPECT_EQ(22.0f, mbgl::Function<float>(22).evaluate(0)); + EXPECT_EQ(2.0f, mbgl::Function<float>(2).evaluate(4)); + EXPECT_EQ(3.8f, mbgl::Function<float>(3.8).evaluate(4)); + EXPECT_EQ(22.0f, mbgl::Function<float>(22).evaluate(4)); + EXPECT_EQ(2.0f, mbgl::Function<float>(2).evaluate(22)); + EXPECT_EQ(3.8f, mbgl::Function<float>(3.8).evaluate(22)); + EXPECT_EQ(22.0f, mbgl::Function<float>(22).evaluate(22)); } TEST(Function, Stops) { // Explicit constant slope in fringe regions. - mbgl::StopsFunction<float> slope_1({ { 0, 1.5 }, { 6, 1.5 }, { 8, 3 }, { 22, 3 } }, 1.75); + mbgl::Function<float> slope_1({ { 0, 1.5 }, { 6, 1.5 }, { 8, 3 }, { 22, 3 } }, 1.75); EXPECT_EQ(1.5, slope_1.evaluate(0)); EXPECT_EQ(1.5, slope_1.evaluate(4)); EXPECT_EQ(1.5, slope_1.evaluate(6)); @@ -31,7 +32,7 @@ TEST(Function, Stops) { // Test constant values in fringe regions. - mbgl::StopsFunction<float> slope_2({ { 6, 1.5 }, { 8, 3 } }, 1.75); + mbgl::Function<float> slope_2({ { 6, 1.5 }, { 8, 3 } }, 1.75); EXPECT_EQ(1.5, slope_2.evaluate(0)); EXPECT_EQ(1.5, slope_2.evaluate(4)); EXPECT_EQ(1.5, slope_2.evaluate(6)); @@ -42,14 +43,14 @@ TEST(Function, Stops) { EXPECT_EQ(3.0, slope_2.evaluate(22)); // Test no values. - mbgl::StopsFunction<float> slope_3({}, 1.75); + mbgl::Function<float> slope_3({}, 1.75); EXPECT_EQ(1, slope_3.evaluate(2)); EXPECT_EQ(1, slope_3.evaluate(6)); EXPECT_EQ(1, slope_3.evaluate(12)); // Explicit constant slope in fringe regions. - mbgl::StopsFunction<float> slope_4({ { 0, 2 }, { 8, 10 } }, 1); + mbgl::Function<float> slope_4({ { 0, 2 }, { 8, 10 } }, 1); EXPECT_EQ(2, slope_4.evaluate(0)); EXPECT_EQ(3, slope_4.evaluate(1)); EXPECT_EQ(4, slope_4.evaluate(2)); |