2021-10-10 20:26:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2021-10-11 13:59:23 +00:00
|
|
|
|
2021-10-20 20:44:43 +00:00
|
|
|
#include "simdjson/simdjson.h"
|
2021-10-11 21:09:03 +00:00
|
|
|
|
2021-10-10 20:26:30 +00:00
|
|
|
class opcode_test_suite_t final {
|
|
|
|
private:
|
2021-10-12 09:10:45 +00:00
|
|
|
// N.B.
|
|
|
|
// The parser must be kept for the lifetime of any parsed data.
|
|
|
|
// Therefore, it can only be used for one document at a time.
|
|
|
|
static simdjson::dom::parser m_parser;
|
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-12 16:07:45 +00:00
|
|
|
std::string m_contents;
|
2021-10-11 21:09:03 +00:00
|
|
|
simdjson::dom::element m_raw;
|
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
|
|
|
[[nodiscard]] const auto raw() const noexcept { return m_raw; }
|
2021-10-11 13:59:23 +00:00
|
|
|
|
2021-10-12 16:07:45 +00:00
|
|
|
void load(); // Reads into contents
|
|
|
|
void parse(); // Parse the contents
|
2021-10-10 20:26:30 +00:00
|
|
|
};
|