blob: 2d75ec712240b395ce045275589d2f49d490c19e [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// TODO( make test data directly available to the goldens test.
// The definitions corresponding to the declarations in this file are
// automatically generated by the build system, using the
// script.
#include <cassert>
#include <map>
#include <string>
#include <utility>
#include <vector>
class Goldens {
// Map from test name to a vector of FIDL filenames, in dependency order. This list of
// FIDL filenames are all present in |fidl_|
static std::map<std::string, std::vector<std::string>>& order() { return dep_order_; }
// Map from test name to the json golden for that test
static std::map<std::string, std::string>& json() { return json_; }
// Map from test name to the coding tables golden for that test
static std::map<std::string, std::string>& tables() { return tables_; }
// Map from fidl filename to the fidl contents of that file
static std::map<std::string, std::string>& fidl() { return fidl_; }
static std::string getFileContents(const std::string& filename) {
const auto& it = Goldens::fidl().find(filename);
assert(it != Goldens::fidl().end() && "missing fidl contents");
return it->second;
static std::vector<std::string> getDepOrder(const std::string& testname) {
const auto& it = Goldens::order().find(testname);
assert(it != Goldens::order().end() && "missing fidl dependency order");
return it->second;
static std::map<std::string, std::vector<std::string>> dep_order_;
static std::map<std::string, std::string> json_;
static std::map<std::string, std::string> tables_;
static std::map<std::string, std::string> fidl_;