|  | // 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(fxbug.dev/43418) 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 gen-goldens.py | 
|  | // script. | 
|  |  | 
|  | #ifndef ZIRCON_SYSTEM_UTEST_FIDL_COMPILER_GOLDENS_H_ | 
|  | #define ZIRCON_SYSTEM_UTEST_FIDL_COMPILER_GOLDENS_H_ | 
|  |  | 
|  | #include <cassert> | 
|  | #include <map> | 
|  | #include <string> | 
|  | #include <utility> | 
|  | #include <vector> | 
|  |  | 
|  | class Goldens { | 
|  | public: | 
|  | // 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; | 
|  | } | 
|  |  | 
|  | private: | 
|  | 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_; | 
|  | }; | 
|  |  | 
|  | #endif  // ZIRCON_SYSTEM_UTEST_FIDL_COMPILER_GOLDENS_H_ |