mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-22 09:30:32 +00:00
Improve overall test speed by reusing test runners.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
75dd53f829
commit
45405d5624
@ -4,8 +4,7 @@
|
||||
std::set<uint8_t> TestRunner::m_undocumented_opcodes;
|
||||
bool TestRunner::m_undocumented_opcodes_initialised = false;
|
||||
|
||||
TestRunner::TestRunner(const test_t test)
|
||||
: m_test(test) {}
|
||||
TestRunner::TestRunner() {}
|
||||
|
||||
EightBit::MemoryMapping TestRunner::mapping(const uint16_t address) noexcept {
|
||||
return { RAM(), 0x0000, 0xffff, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
@ -191,8 +190,16 @@ void TestRunner::disassemble(uint16_t address) {
|
||||
pushCurrentMessage();
|
||||
}
|
||||
|
||||
void TestRunner::check() {
|
||||
initialise();
|
||||
void TestRunner::check(const test_t updated) {
|
||||
|
||||
m_test = updated;
|
||||
|
||||
m_messages.clear();
|
||||
m_actualCycles.clear();
|
||||
m_cycles = 0;
|
||||
m_valid = true;
|
||||
m_undocumented = false;
|
||||
|
||||
raisePOWER();
|
||||
initialiseState();
|
||||
const auto pc = CPU().PC().word;
|
||||
|
@ -25,7 +25,7 @@ private:
|
||||
EightBit::Symbols m_symbols;
|
||||
EightBit::Disassembly m_disassembler = { *this, m_cpu, m_symbols };
|
||||
|
||||
const test_t m_test;
|
||||
test_t m_test;
|
||||
|
||||
std::ostringstream m_os;
|
||||
std::vector<std::string> m_messages;
|
||||
@ -92,7 +92,7 @@ protected:
|
||||
virtual EightBit::MemoryMapping mapping(uint16_t address) noexcept final;
|
||||
|
||||
public:
|
||||
TestRunner(test_t test);
|
||||
TestRunner();
|
||||
|
||||
virtual void raisePOWER() final;
|
||||
virtual void lowerPOWER() final;
|
||||
@ -112,5 +112,5 @@ public:
|
||||
[[nodiscard]] constexpr auto undocumented() const noexcept { return m_undocumented; }
|
||||
[[nodiscard]] constexpr auto documented() const noexcept { return !undocumented(); }
|
||||
|
||||
void check();
|
||||
void check(test_t updated);
|
||||
};
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "element_t.h"
|
||||
|
||||
element_t::element_t() noexcept {}
|
||||
|
||||
element_t::element_t(const simdjson::dom::element input) noexcept
|
||||
: m_raw(input) {}
|
||||
|
@ -6,9 +6,10 @@
|
||||
|
||||
class element_t {
|
||||
private:
|
||||
const simdjson::dom::element m_raw;
|
||||
simdjson::dom::element m_raw;
|
||||
|
||||
protected:
|
||||
element_t() noexcept;
|
||||
element_t(simdjson::dom::element input) noexcept;
|
||||
|
||||
[[nodiscard]] auto raw() const noexcept { return m_raw; }
|
||||
@ -17,4 +18,6 @@ protected:
|
||||
[[nodiscard]] auto operator[](std::string key) const noexcept { return at(key); }
|
||||
[[nodiscard]] auto array_at(std::string key) const noexcept { return at(key).get_array(); }
|
||||
[[nodiscard]] auto integer_at(std::string key) const noexcept { return at(key).get_int64(); }
|
||||
|
||||
|
||||
};
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "test_t.h"
|
||||
|
||||
test_t::test_t() noexcept {}
|
||||
|
||||
test_t::test_t(const simdjson::dom::element input) noexcept
|
||||
: element_t(input) {}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
class test_t final : public element_t {
|
||||
public:
|
||||
test_t() noexcept;
|
||||
test_t(simdjson::dom::element input) noexcept;
|
||||
|
||||
[[nodiscard]] auto name() const noexcept { return at("name"); }
|
||||
|
@ -18,6 +18,9 @@ int main() {
|
||||
int unimplemented_opcode_count = 0;
|
||||
int invalid_opcode_count = 0;
|
||||
|
||||
TestRunner runner;
|
||||
runner.initialise();
|
||||
|
||||
for (const auto& entry : std::filesystem::directory_iterator{ location }) {
|
||||
|
||||
const auto path = entry.path();
|
||||
@ -29,8 +32,7 @@ int main() {
|
||||
for (const auto opcode_test_element : opcode) {
|
||||
|
||||
const auto opcode_test = test_t(opcode_test_element);
|
||||
TestRunner runner(opcode_test);
|
||||
runner.check();
|
||||
runner.check(opcode_test);
|
||||
|
||||
if (runner.invalid()) {
|
||||
++invalid_opcode_count;
|
||||
|
Loading…
Reference in New Issue
Block a user