mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-02-10 16:31:46 +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;
|
std::set<uint8_t> TestRunner::m_undocumented_opcodes;
|
||||||
bool TestRunner::m_undocumented_opcodes_initialised = false;
|
bool TestRunner::m_undocumented_opcodes_initialised = false;
|
||||||
|
|
||||||
TestRunner::TestRunner(const test_t test)
|
TestRunner::TestRunner() {}
|
||||||
: m_test(test) {}
|
|
||||||
|
|
||||||
EightBit::MemoryMapping TestRunner::mapping(const uint16_t address) noexcept {
|
EightBit::MemoryMapping TestRunner::mapping(const uint16_t address) noexcept {
|
||||||
return { RAM(), 0x0000, 0xffff, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
return { RAM(), 0x0000, 0xffff, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||||
@ -191,8 +190,16 @@ void TestRunner::disassemble(uint16_t address) {
|
|||||||
pushCurrentMessage();
|
pushCurrentMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunner::check() {
|
void TestRunner::check(const test_t updated) {
|
||||||
initialise();
|
|
||||||
|
m_test = updated;
|
||||||
|
|
||||||
|
m_messages.clear();
|
||||||
|
m_actualCycles.clear();
|
||||||
|
m_cycles = 0;
|
||||||
|
m_valid = true;
|
||||||
|
m_undocumented = false;
|
||||||
|
|
||||||
raisePOWER();
|
raisePOWER();
|
||||||
initialiseState();
|
initialiseState();
|
||||||
const auto pc = CPU().PC().word;
|
const auto pc = CPU().PC().word;
|
||||||
|
@ -25,7 +25,7 @@ private:
|
|||||||
EightBit::Symbols m_symbols;
|
EightBit::Symbols m_symbols;
|
||||||
EightBit::Disassembly m_disassembler = { *this, m_cpu, 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::ostringstream m_os;
|
||||||
std::vector<std::string> m_messages;
|
std::vector<std::string> m_messages;
|
||||||
@ -92,7 +92,7 @@ protected:
|
|||||||
virtual EightBit::MemoryMapping mapping(uint16_t address) noexcept final;
|
virtual EightBit::MemoryMapping mapping(uint16_t address) noexcept final;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TestRunner(test_t test);
|
TestRunner();
|
||||||
|
|
||||||
virtual void raisePOWER() final;
|
virtual void raisePOWER() final;
|
||||||
virtual void lowerPOWER() final;
|
virtual void lowerPOWER() final;
|
||||||
@ -112,5 +112,5 @@ public:
|
|||||||
[[nodiscard]] constexpr auto undocumented() const noexcept { return m_undocumented; }
|
[[nodiscard]] constexpr auto undocumented() const noexcept { return m_undocumented; }
|
||||||
[[nodiscard]] constexpr auto documented() const noexcept { return !undocumented(); }
|
[[nodiscard]] constexpr auto documented() const noexcept { return !undocumented(); }
|
||||||
|
|
||||||
void check();
|
void check(test_t updated);
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "element_t.h"
|
#include "element_t.h"
|
||||||
|
|
||||||
|
element_t::element_t() noexcept {}
|
||||||
|
|
||||||
element_t::element_t(const simdjson::dom::element input) noexcept
|
element_t::element_t(const simdjson::dom::element input) noexcept
|
||||||
: m_raw(input) {}
|
: m_raw(input) {}
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
|
|
||||||
class element_t {
|
class element_t {
|
||||||
private:
|
private:
|
||||||
const simdjson::dom::element m_raw;
|
simdjson::dom::element m_raw;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
element_t() noexcept;
|
||||||
element_t(simdjson::dom::element input) noexcept;
|
element_t(simdjson::dom::element input) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] auto raw() const noexcept { return m_raw; }
|
[[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 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 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(); }
|
[[nodiscard]] auto integer_at(std::string key) const noexcept { return at(key).get_int64(); }
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "test_t.h"
|
#include "test_t.h"
|
||||||
|
|
||||||
|
test_t::test_t() noexcept {}
|
||||||
|
|
||||||
test_t::test_t(const simdjson::dom::element input) noexcept
|
test_t::test_t(const simdjson::dom::element input) noexcept
|
||||||
: element_t(input) {}
|
: element_t(input) {}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
class test_t final : public element_t {
|
class test_t final : public element_t {
|
||||||
public:
|
public:
|
||||||
|
test_t() noexcept;
|
||||||
test_t(simdjson::dom::element input) noexcept;
|
test_t(simdjson::dom::element input) noexcept;
|
||||||
|
|
||||||
[[nodiscard]] auto name() const noexcept { return at("name"); }
|
[[nodiscard]] auto name() const noexcept { return at("name"); }
|
||||||
|
@ -18,6 +18,9 @@ int main() {
|
|||||||
int unimplemented_opcode_count = 0;
|
int unimplemented_opcode_count = 0;
|
||||||
int invalid_opcode_count = 0;
|
int invalid_opcode_count = 0;
|
||||||
|
|
||||||
|
TestRunner runner;
|
||||||
|
runner.initialise();
|
||||||
|
|
||||||
for (const auto& entry : std::filesystem::directory_iterator{ location }) {
|
for (const auto& entry : std::filesystem::directory_iterator{ location }) {
|
||||||
|
|
||||||
const auto path = entry.path();
|
const auto path = entry.path();
|
||||||
@ -29,8 +32,7 @@ int main() {
|
|||||||
for (const auto opcode_test_element : opcode) {
|
for (const auto opcode_test_element : opcode) {
|
||||||
|
|
||||||
const auto opcode_test = test_t(opcode_test_element);
|
const auto opcode_test = test_t(opcode_test_element);
|
||||||
TestRunner runner(opcode_test);
|
runner.check(opcode_test);
|
||||||
runner.check();
|
|
||||||
|
|
||||||
if (runner.invalid()) {
|
if (runner.invalid()) {
|
||||||
++invalid_opcode_count;
|
++invalid_opcode_count;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user