summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-07 23:58:29 -0400
committerbd <bdunahu@operationnull.com>2025-04-07 23:58:29 -0400
commit0fe2cc70abacc7c9e7aa2602836c8226bb1a1dc3 (patch)
tree6d0b35edad95195221e55c976d944d19c46e6a58 /t
parent1ba3929b633b35a2131960b5344359478594626a (diff)
Add label processing, mnemonic and label lookup maps
Diffstat (limited to 't')
-rw-r--r--t/parse.lisp20
-rw-r--r--t/util.lisp12
2 files changed, 32 insertions, 0 deletions
diff --git a/t/parse.lisp b/t/parse.lisp
new file mode 100644
index 0000000..2ab3e76
--- /dev/null
+++ b/t/parse.lisp
@@ -0,0 +1,20 @@
+(in-package #:rva-tests)
+
+(def-suite parse-tests
+ :description "Test functions exported from the parser."
+ :in all-tests)
+
+(in-suite parse-tests)
+
+(test extract-label-is-a-label
+ (is (not (parse:extract-label '("LOOP" lex::colon)))))
+
+(test extract-label-not-a-label-one
+ (let ((lst '("NICE" "TRY")))
+ (is (equal lst
+ (parse:extract-label lst)))))
+
+(test extract-label-not-a-label-two
+ (let ((lst '("LOOP" lex::colon lex::colon)))
+ (is (equal lst
+ (parse:extract-label lst)))))
diff --git a/t/util.lisp b/t/util.lisp
index ef59fbb..c2dafab 100644
--- a/t/util.lisp
+++ b/t/util.lisp
@@ -14,3 +14,15 @@
(test asm-extension?-returns-true-obvious-case
(is (util:asm-extension? "quux.asm")))
+
+(test format-as-binary-unsigned-no-pad
+ (is (string= (util:format-as-binary 0 0)
+ "0")))
+
+(test format-as-binary-unsigned-no-pad-fourty-two
+ (is (string= (util:format-as-binary 42 0)
+ "101010")))
+
+(test format-as-binary-unsigned-pad-fourty-two
+ (is (string= (util:format-as-binary 42 10)
+ "0000101010")))