summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
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")))