aboutsummaryrefslogtreecommitdiff
path: root/test/ui/v1
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-06-18 00:08:54 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-06-25 00:15:17 +0200
commit0f5581f53f73a92d33826c4771553a9683376e67 (patch)
treeeab8172d21dc4a0b36714af541d22a82cec858f3 /test/ui/v1
parent00a0cb3821ce2bd0fc589ae64ed9cbb791ce44bb (diff)
Adds unit testing scaffold and build tests
Diffstat (limited to 'test/ui/v1')
-rw-r--r--test/ui/v1/noops/ui.c114
-rw-r--r--test/ui/v1/noops/vars.py3
2 files changed, 117 insertions, 0 deletions
diff --git a/test/ui/v1/noops/ui.c b/test/ui/v1/noops/ui.c
new file mode 100644
index 0000000..230e98d
--- /dev/null
+++ b/test/ui/v1/noops/ui.c
@@ -0,0 +1,114 @@
+#if !defined(COMMAND_NEW)
+#error
+#endif
+
+void check_invariants(void) {
+ assert(g_cores->mall == ANC_SIZE);
+ assert(g_cores->muta[0] == 0);
+ assert(g_cores->muta[1] == 0);
+ assert(g_cores->muta[2] == 0);
+ assert(g_cores->muta[3] == 0);
+
+ assert(g_cores->pnum == 1);
+ assert(g_cores->pcap == 1);
+ assert(g_cores->pfst == 0);
+ assert(g_cores->plst == 0);
+ assert(g_cores->pcur == 0);
+ assert(g_cores->psli == 0);
+
+ for (uint64_t i = 0; i < SYNC_INTERVAL; i++) {
+ assert(g_cores->ivav[i] == 0);
+ assert(g_cores->iviv[i] == 0);
+ }
+
+ assert(g_cores->emb1 == 0);
+ assert(g_cores->eliv == 0);
+ assert(g_cores->edea == 0);
+
+ for (uint64_t i = 0; i < MVEC_SIZE; i++) {
+ assert(g_cores->aeva[i] == 0);
+ assert(g_cores->beva[i] == 0);
+ }
+
+ for (uint64_t i = 0; i < INST_COUNT; i++) {
+ assert(g_cores->ipop[i] == 0);
+ assert(g_cores->iwrt[i] == 0);
+ }
+
+ assert(g_cores->wmb0 == 0);
+ assert(g_cores->wmb1 == 0);
+ assert(g_cores->wdea == 0);
+
+ for (uint64_t i = 0; i < MVEC_SIZE; i++) {
+ assert(g_cores->weva[i] == 0);
+ assert(g_cores->xeva[i] == 0);
+ }
+
+ assert(g_cores->pvec->mb0a == 0);
+ assert(g_cores->pvec->mb0s == ANC_SIZE);
+ assert(g_cores->pvec->mb1a == 0);
+ assert(g_cores->pvec->mb1s == 0);
+ assert(g_cores->pvec->r0x == 0);
+ assert(g_cores->pvec->r1x == 0);
+ assert(g_cores->pvec->r2x == 0);
+ assert(g_cores->pvec->r3x == 0);
+ assert(g_cores->pvec->s0 == 0);
+ assert(g_cores->pvec->s1 == 0);
+ assert(g_cores->pvec->s2 == 0);
+ assert(g_cores->pvec->s3 == 0);
+ assert(g_cores->pvec->s4 == 0);
+ assert(g_cores->pvec->s5 == 0);
+ assert(g_cores->pvec->s6 == 0);
+ assert(g_cores->pvec->s7 == 0);
+}
+
+void check_variants(uint64_t step) {
+ assert(g_cores->cycl == step);
+ assert(g_cores->ivpt == step);
+
+ assert(g_cores->emb0 == step);
+
+ for (uint64_t i = 0; i < MVEC_SIZE; i++) {
+ assert(g_cores->eeva[i] == (i < step ? 1 : 0));
+ }
+
+ for (uint64_t i = 0; i < INST_COUNT; i++) {
+ uint64_t exed = 0;
+
+ for (uint64_t j = 0; j < step; j++) {
+ if (mvec_get_inst(g_cores, j) == i) {
+ exed = 1;
+ }
+ }
+
+ assert(g_cores->iexe[i] == exed);
+ }
+
+ assert(g_cores->pvec->ip == step);
+ assert(g_cores->pvec->sp == step);
+}
+
+void check_final(void) {
+ assert(g_cores->pvec->ip == ANC_SIZE);
+ assert(g_cores->pvec->sp == ANC_SIZE);
+}
+
+int main(void) {
+ uint64_t step = 0;
+
+ salis_init();
+ check_invariants();
+ check_variants(step);
+
+ while (mvec_is_proc_owner(g_cores, g_cores->pvec->ip, g_cores->pcur)) {
+ salis_step(1);
+ step++;
+
+ check_invariants();
+ check_variants(step);
+ }
+
+ check_final();
+ salis_free();
+ return 0;
+}
diff --git a/test/ui/v1/noops/vars.py b/test/ui/v1/noops/vars.py
new file mode 100644
index 0000000..9c2a9f3
--- /dev/null
+++ b/test/ui/v1/noops/vars.py
@@ -0,0 +1,3 @@
+flags = set()
+defines = set()
+links = set()