2021-10-10 20:26:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2021-10-11 13:59:23 +00:00
|
|
|
|
|
|
|
#ifdef USE_BOOST_JSON
|
|
|
|
# include <boost/json.hpp>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_NLOHMANN_JSON
|
|
|
|
# include "nlohmann/json.hpp"
|
|
|
|
#endif
|
2021-10-10 20:26:30 +00:00
|
|
|
|
2021-10-11 18:13:05 +00:00
|
|
|
#ifdef USE_JSONCPP_JSON
|
|
|
|
# include <memory>
|
|
|
|
# include <json/json.h>
|
|
|
|
#endif
|
|
|
|
|
2021-10-11 21:09:03 +00:00
|
|
|
#ifdef USE_SIMDJSON_JSON
|
|
|
|
# include "simdjson/simdjson.h"
|
|
|
|
#endif
|
|
|
|
|
2021-10-10 20:26:30 +00:00
|
|
|
class opcode_test_suite_t final {
|
|
|
|
private:
|
2021-10-11 18:13:05 +00:00
|
|
|
#ifdef USE_JSONCPP_JSON
|
|
|
|
static std::unique_ptr<Json::CharReader> m_reader;
|
|
|
|
#endif
|
2021-10-11 21:09:03 +00:00
|
|
|
#ifdef USE_SIMDJSON_JSON
|
|
|
|
static std::unique_ptr<simdjson::dom::parser> m_parser;
|
|
|
|
#endif
|
2021-10-11 18:13:05 +00:00
|
|
|
|
2021-10-11 09:43:33 +00:00
|
|
|
[[nodiscard]] static std::string read(std::string path);
|
2021-10-10 20:26:30 +00:00
|
|
|
|
|
|
|
std::string m_path;
|
2021-10-11 13:59:23 +00:00
|
|
|
#ifdef USE_BOOST_JSON
|
2021-10-10 20:26:30 +00:00
|
|
|
boost::json::value m_raw;
|
2021-10-11 13:59:23 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_NLOHMANN_JSON
|
|
|
|
nlohmann::json m_raw;
|
|
|
|
#endif
|
2021-10-11 18:13:05 +00:00
|
|
|
#ifdef USE_JSONCPP_JSON
|
|
|
|
Json::Value m_raw;
|
|
|
|
#endif
|
2021-10-11 21:09:03 +00:00
|
|
|
#ifdef USE_SIMDJSON_JSON
|
|
|
|
simdjson::dom::element m_raw;
|
|
|
|
#endif
|
2021-10-10 20:26:30 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
opcode_test_suite_t(std::string path);
|
|
|
|
|
2021-10-11 09:43:33 +00:00
|
|
|
[[nodiscard]] constexpr const auto& path() const noexcept { return m_path; }
|
2021-10-11 21:09:03 +00:00
|
|
|
|
|
|
|
#ifdef JSON_PREFER_PASS_BY_VALUE
|
|
|
|
[[nodiscard]] const auto raw() const noexcept { return m_raw; }
|
|
|
|
#else
|
2021-10-11 09:43:33 +00:00
|
|
|
[[nodiscard]] constexpr const auto& raw() const noexcept { return m_raw; }
|
2021-10-11 21:09:03 +00:00
|
|
|
#endif
|
2021-10-11 13:59:23 +00:00
|
|
|
|
|
|
|
#ifdef USE_BOOST_JSON
|
2021-10-11 09:43:33 +00:00
|
|
|
[[nodiscard]] const boost::json::array& get_array() const noexcept;
|
2021-10-11 13:59:23 +00:00
|
|
|
#endif
|
2021-10-10 20:26:30 +00:00
|
|
|
|
|
|
|
void load();
|
|
|
|
};
|