mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-26 21:18:36 +00:00
So I can compare implementations, add a non-coroutine variant of the HarteTest suite.
This commit is contained in:
1 parent
3ca84b516a
commit
53ef92dbc4
6 files changed
+71
No files matched your search
@@ -4,6 +4,7 @@
|
|||||||
opcode_test_suite_t::opcode_test_suite_t(const std::string path) noexcept
|
opcode_test_suite_t::opcode_test_suite_t(const std::string path) noexcept
|
||||||
: parser_t(path) {}
|
: parser_t(path) {}
|
||||||
|
|
||||||
|
#ifdef USE_COROUTINES
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L
|
||||||
EightBit::co_generator_t<test_t> opcode_test_suite_t::generator() {
|
EightBit::co_generator_t<test_t> opcode_test_suite_t::generator() {
|
||||||
for (const auto element : *this)
|
for (const auto element : *this)
|
||||||
@@ -14,4 +15,12 @@ void opcode_test_suite_t::generator(boost::coroutines2::coroutine<test_t>::push_
|
|||||||
for (const auto element : *this)
|
for (const auto element : *this)
|
||||||
sink(test_t(element));
|
sink(test_t(element));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
std::vector<test_t> opcode_test_suite_t::generate() {
|
||||||
|
std::vector<test_t> returned;
|
||||||
|
for (const auto element : *this)
|
||||||
|
returned.push_back(test_t(element));
|
||||||
|
return returned;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2,11 +2,14 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#ifdef USE_COROUTINES
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L
|
||||||
# include <co_generator_t.h>
|
# include <co_generator_t.h>
|
||||||
#else
|
#else
|
||||||
# include <boost/coroutine2/all.hpp>
|
# include <boost/coroutine2/all.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
# include <vector>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "parser_t.h"
|
#include "parser_t.h"
|
||||||
#include "test_t.h"
|
#include "test_t.h"
|
||||||
@@ -22,9 +25,13 @@ public:
|
|||||||
[[nodiscard]] auto begin() const noexcept { return array().begin(); }
|
[[nodiscard]] auto begin() const noexcept { return array().begin(); }
|
||||||
[[nodiscard]] auto end() const noexcept { return array().end(); }
|
[[nodiscard]] auto end() const noexcept { return array().end(); }
|
||||||
|
|
||||||
|
#ifdef USE_COROUTINES
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L
|
||||||
[[nodiscard]] EightBit::co_generator_t<test_t> generator();
|
[[nodiscard]] EightBit::co_generator_t<test_t> generator();
|
||||||
#else
|
#else
|
||||||
void generator(boost::coroutines2::coroutine<test_t>::push_type& sink);
|
void generator(boost::coroutines2::coroutine<test_t>::push_type& sink);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
std::vector<test_t> generate();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
@@ -7,6 +7,7 @@ processor_test_suite_t::processor_test_suite_t(std::string location) noexcept
|
|||||||
: m_location(location) {
|
: m_location(location) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_COROUTINES
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L
|
||||||
EightBit::co_generator_t<opcode_test_suite_t> processor_test_suite_t::generator() {
|
EightBit::co_generator_t<opcode_test_suite_t> processor_test_suite_t::generator() {
|
||||||
std::filesystem::path directory = location();
|
std::filesystem::path directory = location();
|
||||||
@@ -20,3 +21,12 @@ void processor_test_suite_t::generator(boost::coroutines2::coroutine<opcode_test
|
|||||||
sink(opcode_test_suite_t(entry.path().string()));
|
sink(opcode_test_suite_t(entry.path().string()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
std::vector<opcode_test_suite_t> processor_test_suite_t::generate() {
|
||||||
|
std::vector<opcode_test_suite_t> returned;
|
||||||
|
std::filesystem::path directory = location();
|
||||||
|
for (const auto& entry : std::filesystem::directory_iterator{ directory })
|
||||||
|
returned.push_back(opcode_test_suite_t(entry.path().string()));
|
||||||
|
return returned;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -3,11 +3,15 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
|
||||||
|
#ifdef USE_COROUTINES
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L
|
||||||
# include <co_generator_t.h>
|
# include <co_generator_t.h>
|
||||||
#else
|
#else
|
||||||
# include <boost/coroutine2/all.hpp>
|
# include <boost/coroutine2/all.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
# include <vector>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "opcode_test_suite_t.h"
|
#include "opcode_test_suite_t.h"
|
||||||
|
|
||||||
@@ -20,9 +24,13 @@ public:
|
|||||||
|
|
||||||
std::string_view location() const noexcept { return m_location; }
|
std::string_view location() const noexcept { return m_location; }
|
||||||
|
|
||||||
|
#ifdef USE_COROUTINES
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L
|
||||||
[[nodiscard]] EightBit::co_generator_t<opcode_test_suite_t> generator();
|
[[nodiscard]] EightBit::co_generator_t<opcode_test_suite_t> generator();
|
||||||
#else
|
#else
|
||||||
void generator(boost::coroutines2::coroutine<opcode_test_suite_t>::push_type& sink);
|
void generator(boost::coroutines2::coroutine<opcode_test_suite_t>::push_type& sink);
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
std::vector<opcode_test_suite_t> generate();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
@@ -22,11 +22,15 @@
|
|||||||
#include <Disassembly.h>
|
#include <Disassembly.h>
|
||||||
#include <Symbols.h>
|
#include <Symbols.h>
|
||||||
|
|
||||||
|
#define USE_COROUTINES
|
||||||
|
|
||||||
|
#ifdef USE_COROUTINES
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L
|
||||||
# include <co_generator_t.h>
|
# include <co_generator_t.h>
|
||||||
#else
|
#else
|
||||||
# include <boost/coroutine2/all.hpp>
|
# include <boost/coroutine2/all.hpp>
|
||||||
# include <boost/bind.hpp>
|
# include <boost/bind.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "simdjson/simdjson.h"
|
#include "simdjson/simdjson.h"
|
||||||
@@ -30,6 +30,8 @@ int main() {
|
|||||||
checker_t checker(runner);
|
checker_t checker(runner);
|
||||||
checker.initialise();
|
checker.initialise();
|
||||||
|
|
||||||
|
#ifdef USE_COROUTINES
|
||||||
|
|
||||||
#if __cplusplus >= 202002L
|
#if __cplusplus >= 202002L
|
||||||
|
|
||||||
processor_test_suite_t m6502_tests(directory);
|
processor_test_suite_t m6502_tests(directory);
|
||||||
@@ -91,6 +93,37 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
processor_test_suite_t m6502_tests(directory);
|
||||||
|
auto opcodes = m6502_tests.generate();
|
||||||
|
for (auto& opcode : opcodes) {
|
||||||
|
|
||||||
|
const auto path = std::filesystem::path(opcode.path());
|
||||||
|
std::cout << "Processing: " << path.filename() << "\n";
|
||||||
|
opcode.load();
|
||||||
|
|
||||||
|
auto tests = opcode.generate();
|
||||||
|
for (auto& test : tests) {
|
||||||
|
|
||||||
|
checker.check(test);
|
||||||
|
|
||||||
|
if (checker.invalid()) {
|
||||||
|
++invalid_opcode_count;
|
||||||
|
if (checker.unimplemented())
|
||||||
|
++unimplemented_opcode_count;
|
||||||
|
if (checker.undocumented())
|
||||||
|
++undocumented_opcode_count;
|
||||||
|
std::cout << "** Failed: " << test.name() << "\n";
|
||||||
|
for (const auto& message : checker.messages())
|
||||||
|
std::cout << "**** " << message << "\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const auto finish_time = std::chrono::steady_clock::now();
|
const auto finish_time = std::chrono::steady_clock::now();
|
||||||
|
|||||||
Reference in new issue
Block a user