aboutsummaryrefslogtreecommitdiff
path: root/test/ui/v1/mbops/ui.c
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-06-25 04:42:23 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-06-28 02:50:18 +0200
commit95fd6ae836ab5fee7387f4df46b727165a05b723 (patch)
tree79c715d250f44c1aa1a0d05e65be313ae4cd3e15 /test/ui/v1/mbops/ui.c
parent0f5581f53f73a92d33826c4771553a9683376e67 (diff)
Adds v1 unit tests and fixes bugs found by them
Diffstat (limited to 'test/ui/v1/mbops/ui.c')
-rw-r--r--test/ui/v1/mbops/ui.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/ui/v1/mbops/ui.c b/test/ui/v1/mbops/ui.c
new file mode 100644
index 0000000..8a92d6f
--- /dev/null
+++ b/test/ui/v1/mbops/ui.c
@@ -0,0 +1,36 @@
+#if !defined(COMMAND_NEW)
+#error
+#endif
+
+int main(void) {
+ salis_init();
+
+ while (g_cores->pvec->ip < ANC_SIZE) {
+ bool on_swap = mvec_get_inst(g_cores, g_cores->pvec->ip) == bswp;
+ bool on_clear = mvec_get_inst(g_cores, g_cores->pvec->ip) == bclr;
+
+ uint64_t mb0a = g_cores->pvec->mb0a;
+ uint64_t mb0s = g_cores->pvec->mb0s;
+ uint64_t mb1a = g_cores->pvec->mb1a;
+ uint64_t mb1s = g_cores->pvec->mb1s;
+
+ salis_step(1);
+
+ if (on_swap) {
+ if (mb1s) {
+ assert(g_cores->pvec->mb0a == mb1a);
+ assert(g_cores->pvec->mb0s == mb1s);
+ assert(g_cores->pvec->mb1a == mb0a);
+ assert(g_cores->pvec->mb1s == mb0s);
+ }
+ }
+
+ if (on_clear) {
+ assert(g_cores->pvec->mb1a == 0);
+ assert(g_cores->pvec->mb1s == 0);
+ }
+ }
+
+ salis_free();
+ return 0;
+}