EightBit/M6502/HarteTest_6502/tests.cpp
2021-10-11 10:20:18 +01:00

42 lines
1.2 KiB
C++

#include "stdafx.h"
#include <iostream>
#include <filesystem>
#include "TestRunner.h"
#include "test_t.h"
#include "opcode_test_suite_t.h"
int main() {
std::filesystem::path location = "C:\\github\\spectrum\\libraries\\EightBit\\modules\\ProcessorTests\\6502\\v1";
for (const auto& entry : std::filesystem::directory_iterator{ location }) {
const auto path = entry.path();
const auto filename = path.filename();
std::cout << "Processing: " << filename << "\n";
opcode_test_suite_t opcode(path.string());
opcode.load();
const auto& opcode_test_array = opcode.get_array();
bool opcode_bad = false;
for (const auto& opcode_test_element : opcode_test_array) {
const auto opcode_test = test_t(opcode_test_element);
TestRunner runner(opcode_test);
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;
}
}
}
}
}