2021-10-10 20:26:30 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
2021-10-11 13:59:23 +00:00
|
|
|
#include <chrono>
|
2021-10-10 20:26:30 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
#include "TestRunner.h"
|
|
|
|
#include "test_t.h"
|
|
|
|
#include "opcode_test_suite_t.h"
|
|
|
|
|
|
|
|
int main() {
|
2021-10-11 09:20:18 +00:00
|
|
|
|
2021-10-10 20:26:30 +00:00
|
|
|
std::filesystem::path location = "C:\\github\\spectrum\\libraries\\EightBit\\modules\\ProcessorTests\\6502\\v1";
|
|
|
|
|
2021-10-11 13:59:23 +00:00
|
|
|
const auto start_time = std::chrono::steady_clock::now();
|
|
|
|
|
2021-10-10 20:26:30 +00:00
|
|
|
for (const auto& entry : std::filesystem::directory_iterator{ location }) {
|
|
|
|
|
|
|
|
const auto path = entry.path();
|
2021-10-11 09:20:18 +00:00
|
|
|
|
2021-10-12 16:07:45 +00:00
|
|
|
std::cout << "Processing: " << path.filename() << "\n";
|
2021-10-10 20:26:30 +00:00
|
|
|
opcode_test_suite_t opcode(path.string());
|
|
|
|
opcode.load();
|
2021-10-12 16:07:45 +00:00
|
|
|
opcode.parse();
|
2021-10-11 13:59:23 +00:00
|
|
|
|
2021-10-18 10:54:01 +00:00
|
|
|
#ifdef USE_SIMDJSON_JSON
|
|
|
|
const auto opcode_test_array = opcode.raw().get_array();
|
|
|
|
#endif
|
2021-10-18 23:39:26 +00:00
|
|
|
#ifdef USE_RAPIDJSON_JSON
|
|
|
|
const auto& opcode_test_array = opcode.raw().GetArray();
|
|
|
|
#endif
|
2021-10-11 13:59:23 +00:00
|
|
|
#ifdef USE_BOOST_JSON
|
2021-10-18 19:40:13 +00:00
|
|
|
const auto& opcode_test_array = opcode.raw().get_array();
|
2021-10-11 13:59:23 +00:00
|
|
|
#endif
|
|
|
|
#ifdef USE_NLOHMANN_JSON
|
|
|
|
const auto& opcode_test_array = opcode.raw();
|
2021-10-18 10:54:01 +00:00
|
|
|
assert(opcode_test_array.is_array());
|
2021-10-11 13:59:23 +00:00
|
|
|
#endif
|
2021-10-11 18:13:05 +00:00
|
|
|
#ifdef USE_JSONCPP_JSON
|
|
|
|
const auto& opcode_test_array = opcode.raw();
|
2021-10-17 17:36:27 +00:00
|
|
|
assert(opcode_test_array.is_array());
|
2021-10-11 18:13:05 +00:00
|
|
|
#endif
|
2021-10-11 09:20:18 +00:00
|
|
|
|
|
|
|
bool opcode_bad = false;
|
2021-10-10 20:26:30 +00:00
|
|
|
for (const auto& opcode_test_element : opcode_test_array) {
|
|
|
|
|
|
|
|
const auto opcode_test = test_t(opcode_test_element);
|
|
|
|
|
|
|
|
TestRunner runner(opcode_test);
|
2021-10-11 18:52:22 +00:00
|
|
|
#ifndef TEST_JSON_PERFORMANCE
|
2021-10-11 09:20:18 +00:00
|
|
|
const auto good = runner.check();
|
|
|
|
if (!good) {
|
|
|
|
if (!opcode_bad) {
|
|
|
|
std::cout << "** Failed: " << opcode_test.name() << "\n";
|
|
|
|
for (const auto& message : runner.messages())
|
|
|
|
std::cout << "**** " << message << "\n";
|
|
|
|
opcode_bad = true;
|
|
|
|
}
|
|
|
|
}
|
2021-10-11 18:52:22 +00:00
|
|
|
#endif
|
2021-10-10 20:26:30 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-11 13:59:23 +00:00
|
|
|
|
|
|
|
const auto finish_time = std::chrono::steady_clock::now();
|
|
|
|
const auto elapsed_time = finish_time - start_time;
|
|
|
|
const auto seconds = std::chrono::duration_cast<std::chrono::duration<double>>(elapsed_time).count();
|
|
|
|
std::cout << "Elapsed time: " << seconds << " seconds" << std::endl;
|
2021-10-10 20:26:30 +00:00
|
|
|
}
|