summaryrefslogtreecommitdiff
path: root/render-test/parser.hpp
blob: 3e699681520b1d19fc29993e3842a2e4c2498d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include <mbgl/util/rapidjson.hpp>
#include <mbgl/util/variant.hpp>

#include <tuple>
#include <string>
#include <vector>

#include "filesystem.hpp"

struct TestMetadata;
struct TestStatistics;
struct TestPaths;

using ErrorMessage = std::string;
using JSONReply = mbgl::variant<mbgl::JSDocument, ErrorMessage>;

using ArgumentsTuple = std::tuple<bool, bool, uint32_t, std::string, std::vector<std::string>>;

JSONReply readJson(const mbgl::filesystem::path&);
std::string serializeJsonValue(const mbgl::JSValue&);

std::vector<std::string> readExpectedEntries(const mbgl::filesystem::path& base);

ArgumentsTuple parseArguments(int argc, char** argv);
std::vector<std::pair<std::string, std::string>> parseIgnores();

TestMetadata parseTestMetadata(const TestPaths& paths);

std::string createResultPage(const TestStatistics&, const std::vector<TestMetadata>&, bool shuffle, uint32_t seed);

std::string localizeURL(const std::string& url);

void localizeSourceURLs(mbgl::JSValue& root, mbgl::JSDocument& document);
void localizeStyleURLs(mbgl::JSValue& root, mbgl::JSDocument& document);