summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/build.sh1
-rw-r--r--test/dwarf.rc10
-rw-r--r--test/imp.rc4
-rw-r--r--test/test.cpp85
4 files changed, 0 insertions, 100 deletions
diff --git a/test/build.sh b/test/build.sh
deleted file mode 100644
index 199813d..0000000
--- a/test/build.sh
+++ /dev/null
@@ -1 +0,0 @@
-g++ -O2 --std=c++20 -DCORE_SIZE=16 test.cpp ../lib94/*.cpp -I ../include -o test
diff --git a/test/dwarf.rc b/test/dwarf.rc
deleted file mode 100644
index ff64ddc..0000000
--- a/test/dwarf.rc
+++ /dev/null
@@ -1,10 +0,0 @@
-;author Standard
-;name Dwarf
-
-org 1
-
-dat 1, 1 ;not 0, 0 so i can see it change
-
-mov 0-1, 3
-add.ab #4, 0-1
-jmp 0-2
diff --git a/test/imp.rc b/test/imp.rc
deleted file mode 100644
index c6415fd..0000000
--- a/test/imp.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-;author Standard
-;name Imp
-
-mov 0, 1
diff --git a/test/test.cpp b/test/test.cpp
deleted file mode 100644
index b838a02..0000000
--- a/test/test.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include <lib94/lib94.hpp>
-#include <iostream>
-#include <cassert>
-#include <fstream>
-#include <chrono>
-#include <thread>
-
-const char *const opcodes[] = {
- "dat", "mov", "add", "sub",
- "mul", "div", "mod", "jmp",
- "jmz", "jmn", "djn", "seq",
- "sne", "slt", "spl", "nop"
-};
-
-const char *const modifiers[] = {
- "a ", "b ", "ab", "ba", "f ", "x ", "i "
-};
-
-const char *modes = "#$*@{<}>";
-
-int main(int argc, const char **argv) {
- assert(argc > 1);
-
- seed_prng(time(0));
-
- std::vector<const warrior *> ws;
-
- for (int i = 1; i < argc; ++i) {
- std::string source;
- std::ifstream f(argv[i]);
- std::getline(f, source, '\0');
- f.close();
-
- auto result = compile_warrior(source);
- if (std::holds_alternative<std::string>(result)) {
- std::cout << "Error in " << argv[i] << ": " << std::get<std::string>(result) << std::endl;
- return 0;
- }
-
- ws.push_back(std::get<warrior *>(result));
- }
-
- std::vector<number_t> wps;
- wps.resize(ws.size());
-
- clear_core({.op = DAT, .mod = F, .amode = DIRECT, .bmode = DIRECT, .anumber = 0, .bnumber = 0});
- init_round(ws);
-
- while (true) {
- for (int i = 0; i < ws.size(); ++i)
- if (get_processes(ws[i]).size() == 0)
- wps[i] = -1;
- else
- wps[i] = get_next_process(ws[i]);
-
- auto mod = get_modified_addresses();
-
- printf("\x1b[H\x1b[2J");
-
- for (int a = 0; a < CORE_SIZE; ++a) {
- const instruction &i = get_instruction(a);
-
- printf("%d: %s.%s %c%d, %c%d",
- a, opcodes[i.op], modifiers[i.mod],
- modes[i.amode], i.anumber,
- modes[i.bmode], i.bnumber);
-
- if (mod.contains(a))
- printf(" *");
-
- for (int w = 0; w < ws.size(); ++w)
- if (a == wps[w])
- printf(" < %s", ws[w]->name.c_str());
-
- putchar('\n');
- }
-
- std::this_thread::sleep_for(std::chrono::milliseconds(250));
-
- clear_modified_addresses();
- single_step();
- }
-
- return 0;
-}