summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-08-10 18:02:12 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-08-10 18:02:12 +0200
commitecafa5d239474fb6cfde84c3fe5a1267cd3d0bbb (patch)
tree40586ac03dc174f5f0db83c0e05c5562f3a46381 /tests
parent518fb8205ae251e10d642fc8816f0a6720e3b440 (diff)
tests: quantity testing
Diffstat (limited to 'tests')
-rw-r--r--tests/parse.scm15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/parse.scm b/tests/parse.scm
index c4670e0..28707a0 100644
--- a/tests/parse.scm
+++ b/tests/parse.scm
@@ -4,10 +4,16 @@
(cook debug)
(cook parse-internals))
-(test "Amount with unit"
- (list 'amount "10" "l") (cook->list (parse amount "10%l")))
-(test "Amount without unit"
- (list 'amount "10" #f) (cook->list (parse amount "10")))
+(test-group "Amount"
+ (test "with unit"
+ (list 'amount 10 "l") (cook->list (parse amount "10%l")))
+ (test "without unit"
+ (list 'amount 10 #f) (cook->list (parse amount "10"))))
+
+(test-group "Quantity"
+ (test "integer" 10 (parse quantity "10"))
+ (test "float" 10.1 (parse quantity "10.1"))
+ (test "fraction" 1/10 (parse quantity "1/10")))
;(define (test x y)
; (display "Testing: ")
@@ -25,7 +31,6 @@
;
;(test 'WORD (parse word "hola. adios"))
;(test 'UNIT (parse unit "l"))
-;(test 'QUANTITY (parse quantity "10"))
;(test 'WORD-COMPONENT (parse-fully component "word{}"))
;(test 'WORD-COMPONENT (parse-fully component "word{9%head}"))
;(test 'WORD-COMPONENT (parse-fully component "word"))