Add clang-format (#1086)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Bart Louwers
2023-05-01 16:57:37 +02:00
committed by GitHub
parent 403a12bd1b
commit 71f6da2722
1018 changed files with 27876 additions and 25862 deletions

View File

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