[core] default value support in categorical function conversion

This commit is contained in:
Ivo van Dongen
2017-01-31 15:44:18 +02:00
committed by John Firebaugh
parent 141e995806
commit 8a5bff8ee6
19 changed files with 243 additions and 64 deletions

View File

@@ -95,6 +95,8 @@ TEST(Stringify, SourceFunction) {
"{\"property\":\"property\",\"type\":\"categorical\",\"stops\":[[true,1.0]]}");
ASSERT_EQ(stringify(SourceFunction<float>("property", IdentityStops<float> {})),
"{\"property\":\"property\",\"type\":\"identity\"}");
ASSERT_EQ(stringify(SourceFunction<float>("property", IdentityStops<float> {}, 0.0f)),
"{\"property\":\"property\",\"type\":\"identity\",\"default\":0.0}");
}
TEST(Stringify, CompositeFunction) {
@@ -102,11 +104,11 @@ TEST(Stringify, CompositeFunction) {
std::map<float, ExponentialStops<float>> {
{ 0, ExponentialStops<float> { {{0, 1}}, 2 } },
{ 1, ExponentialStops<float> { {{0, 1}}, 2 } }
})),
}, 0.0f)),
"{\"property\":\"property\",\"type\":\"exponential\",\"base\":2.0,"
"\"stops\":["
"[{\"zoom\":0.0,\"value\":0.0},1.0],"
"[{\"zoom\":1.0,\"value\":0.0},1.0]]}");
"[{\"zoom\":1.0,\"value\":0.0},1.0]],\"default\":0.0}");
}
TEST(Stringify, PropertyValue) {