#pragma once #include "filesystem.hpp" #include #include #include #include #include #include #include using namespace mbgl; struct Input { Input(optional zoom_, optional heatmapDensity_, optional canonical_, std::set availableImages_, Feature feature_) : zoom(std::move(zoom_)), heatmapDensity(std::move(heatmapDensity_)), canonical(std::move(canonical_)), availableImages(std::move(availableImages_)), feature(std::move(feature_)) {} optional zoom; optional heatmapDensity; optional canonical; std::set availableImages; Feature feature; }; struct Compiled { bool operator==(const Compiled& other) const { bool typeEqual = success == other.success && isFeatureConstant == other.isFeatureConstant && isZoomConstant == other.isZoomConstant && serializedType == other.serializedType && errors == other.errors; return typeEqual; } bool success = false; bool isFeatureConstant = false; bool isZoomConstant = false; std::string serializedType; std::vector errors; }; struct TestResult { Compiled compiled; optional expression; optional outputs; optional serialized; }; struct PropertySpec { std::string type; std::string value; std::size_t length = 0; bool isDataDriven = false; optional expression; }; class TestData { public: std::vector inputs; TestResult expected; TestResult result; TestResult recompiled; optional spec; JSDocument document; }; struct Ignore { Ignore(std::string id_, std::string reason_) : id(std::move(id_)), reason(std::move(reason_)) {} std::string id; std::string reason; }; using Arguments = std::tuple, bool, uint32_t>; Arguments parseArguments(int argc, char** argv); using Ignores = std::vector; Ignores parseExpressionIgnores(); optional parseTestData(const filesystem::path&); std::string toJSON(const Value& value, unsigned indent = 0, bool singleLine = false); JSDocument toDocument(const Value&); Value toValue(const Compiled&); optional toValue(const style::expression::Value&); std::unique_ptr parseExpression(const JSValue&, optional&, TestResult&); std::unique_ptr parseExpression(const optional&, optional&, TestResult&);