@@ -59,15 +59,15 @@ TEST(Stringify, Color) {
|
||||
}
|
||||
|
||||
TEST(Stringify, Array) {
|
||||
ASSERT_EQ(stringify(std::array<float, 2> {{ 1, 2 }}), "[1.0,2.0]");
|
||||
ASSERT_EQ(stringify(std::array<float, 2>{{1, 2}}), "[1.0,2.0]");
|
||||
}
|
||||
|
||||
TEST(Stringify, Vector) {
|
||||
ASSERT_EQ(stringify(std::vector<float> {{ 1, 2 }}), "[1.0,2.0]");
|
||||
ASSERT_EQ(stringify(std::vector<float>{{1, 2}}), "[1.0,2.0]");
|
||||
}
|
||||
|
||||
TEST(Stringify, Map) {
|
||||
ASSERT_EQ(stringify(std::unordered_map<std::string, float> {{ "a", 1.0f }}), "{\"a\":1.0}");
|
||||
ASSERT_EQ(stringify(std::unordered_map<std::string, float>{{"a", 1.0f}}), "{\"a\":1.0}");
|
||||
}
|
||||
|
||||
TEST(Stringify, Value) {
|
||||
@@ -84,53 +84,40 @@ TEST(Stringify, Filter) {
|
||||
|
||||
TEST(Stringify, PropertyExpression) {
|
||||
using namespace mbgl::style::expression::dsl;
|
||||
ASSERT_EQ(stringify(PropertyExpression<float>(
|
||||
interpolate(
|
||||
linear(),
|
||||
zoom(),
|
||||
0.0, literal(1.0),
|
||||
1.0, literal(2.0)
|
||||
))),
|
||||
"[\"interpolate\",[\"linear\"],[\"zoom\"],0.0,1.0,1.0,2.0]");
|
||||
ASSERT_EQ(stringify(PropertyExpression<float>(interpolate(linear(), zoom(), 0.0, literal(1.0), 1.0, literal(2.0)))),
|
||||
"[\"interpolate\",[\"linear\"],[\"zoom\"],0.0,1.0,1.0,2.0]");
|
||||
|
||||
ASSERT_EQ(stringify(PropertyExpression<float>(
|
||||
interpolate(
|
||||
exponential(2.0),
|
||||
number(get("property")),
|
||||
0.0, literal(1.0),
|
||||
1.0, literal(2.0)
|
||||
))),
|
||||
"[\"interpolate\",[\"exponential\",2.0],[\"number\",[\"get\",\"property\"]],0.0,1.0,1.0,2.0]");
|
||||
interpolate(exponential(2.0), number(get("property")), 0.0, literal(1.0), 1.0, literal(2.0)))),
|
||||
"[\"interpolate\",[\"exponential\",2.0],[\"number\",[\"get\","
|
||||
"\"property\"]],0.0,1.0,1.0,2.0]");
|
||||
|
||||
ASSERT_EQ(stringify(PropertyExpression<float>(
|
||||
interpolate(
|
||||
linear(),
|
||||
zoom(),
|
||||
0.0, interpolate(exponential(2.0), number(get("property")), 0.0, literal(1.0), 1.0, literal(2.0)),
|
||||
1.0, interpolate(exponential(2.0), number(get("property")), 0.0, literal(1.0), 1.0, literal(2.0))
|
||||
))),
|
||||
"[\"interpolate\","
|
||||
"[\"linear\"],"
|
||||
"[\"zoom\"],"
|
||||
"0.0,[\"interpolate\",[\"exponential\",2.0],[\"number\",[\"get\",\"property\"]],0.0,1.0,1.0,2.0],"
|
||||
"1.0,[\"interpolate\",[\"exponential\",2.0],[\"number\",[\"get\",\"property\"]],0.0,1.0,1.0,2.0]]");
|
||||
ASSERT_EQ(stringify(PropertyExpression<float>(interpolate(
|
||||
linear(),
|
||||
zoom(),
|
||||
0.0,
|
||||
interpolate(exponential(2.0), number(get("property")), 0.0, literal(1.0), 1.0, literal(2.0)),
|
||||
1.0,
|
||||
interpolate(exponential(2.0), number(get("property")), 0.0, literal(1.0), 1.0, literal(2.0))))),
|
||||
"[\"interpolate\","
|
||||
"[\"linear\"],"
|
||||
"[\"zoom\"],"
|
||||
"0.0,[\"interpolate\",[\"exponential\",2.0],[\"number\",[\"get\","
|
||||
"\"property\"]],0.0,1.0,1.0,2.0],"
|
||||
"1.0,[\"interpolate\",[\"exponential\",2.0],[\"number\",[\"get\","
|
||||
"\"property\"]],0.0,1.0,1.0,2.0]]");
|
||||
}
|
||||
|
||||
TEST(Stringify, PropertyValue) {
|
||||
using namespace mbgl::style::expression::dsl;
|
||||
ASSERT_EQ(stringify(PropertyValue<float>(1)), "1.0");
|
||||
ASSERT_EQ(stringify(PropertyValue<float>(PropertyExpression<float>(
|
||||
interpolate(
|
||||
exponential(2.0),
|
||||
zoom(),
|
||||
0.0, literal(1.0),
|
||||
1.0, literal(2.0)
|
||||
)))),
|
||||
"[\"interpolate\",[\"exponential\",2.0],[\"zoom\"],0.0,1.0,1.0,2.0]");
|
||||
interpolate(exponential(2.0), zoom(), 0.0, literal(1.0), 1.0, literal(2.0))))),
|
||||
"[\"interpolate\",[\"exponential\",2.0],[\"zoom\"],0.0,1.0,1.0,2.0]");
|
||||
}
|
||||
|
||||
TEST(Stringify, Layout) {
|
||||
auto stringify = [] (const SymbolLayoutProperties::Unevaluated& layout) {
|
||||
auto stringify = [](const SymbolLayoutProperties::Unevaluated& layout) {
|
||||
rapidjson::StringBuffer s;
|
||||
rapidjson::Writer<rapidjson::StringBuffer> writer(s);
|
||||
layout.stringify(writer);
|
||||
|
||||
Reference in New Issue
Block a user