[core] Make ExponentialStops behavior consistent; add tests

This commit is contained in:
John Firebaugh
2017-05-19 11:12:05 -07:00
parent bdff99c853
commit 1f921299b0
5 changed files with 44 additions and 4 deletions

View File

@@ -0,0 +1,20 @@
#include <mbgl/test/util.hpp>
#include <mbgl/style/function/interval_stops.hpp>
using namespace mbgl;
using namespace mbgl::style;
TEST(IntervalStops, Empty) {
IntervalStops<float> stops;
EXPECT_FALSE(bool(stops.evaluate(0)));
}
TEST(IntervalStops, NonNumericInput) {
IntervalStops<float> stops(std::map<float, float> {{0.0f, 0.0f}});
EXPECT_FALSE(bool(stops.evaluate(Value(NullValue()))));
EXPECT_FALSE(bool(stops.evaluate(Value(false))));
EXPECT_FALSE(bool(stops.evaluate(Value(std::string()))));
EXPECT_FALSE(bool(stops.evaluate(Value(std::vector<Value>()))));
EXPECT_FALSE(bool(stops.evaluate(Value(std::unordered_map<std::string, Value>()))));
}