mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-23 18:30:51 +00:00
b70f24a581
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
31 lines
742 B
C++
31 lines
742 B
C++
#include "stdafx.h"
|
|
#include "opcode_test_suite_t.h"
|
|
|
|
#include <cassert>
|
|
#include <exception>
|
|
#include <fstream>
|
|
#include <filesystem>
|
|
|
|
simdjson::dom::parser opcode_test_suite_t::m_parser;
|
|
|
|
std::string opcode_test_suite_t::read(std::string path) {
|
|
std::ifstream file(path, std::ios::in | std::ios::binary);
|
|
const auto size = std::filesystem::file_size(path);
|
|
std::string result(size, '\0');
|
|
file.read(result.data(), size);
|
|
return result;
|
|
}
|
|
|
|
opcode_test_suite_t::opcode_test_suite_t(std::string path)
|
|
: m_path(path) {}
|
|
|
|
void opcode_test_suite_t::load() {
|
|
m_contents = read(path());
|
|
}
|
|
|
|
void opcode_test_suite_t::parse() {
|
|
m_raw = m_parser.parse(m_contents);
|
|
m_contents.clear();
|
|
m_contents.shrink_to_fit();
|
|
}
|