summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-08-10 16:04:45 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-08-10 17:08:15 +0200
commit518fb8205ae251e10d642fc8816f0a6720e3b440 (patch)
tree1b68a4b791e7320275cdc8fbae088f47baa2599b /tests
parentd720bcd8aa948fb58087ca9c11a8c8c5ab52db4b (diff)
Make some project structure
Diffstat (limited to 'tests')
-rw-r--r--tests/parse.scm44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/parse.scm b/tests/parse.scm
new file mode 100644
index 0000000..c4670e0
--- /dev/null
+++ b/tests/parse.scm
@@ -0,0 +1,44 @@
+(import (chibi)
+ (chibi test)
+ (chibi parse)
+ (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")))
+
+;(define (test x y)
+; (display "Testing: ")
+; (display x)
+; (display " == ")
+; (display (cook->list y))
+; (newline))
+
+;(test 'NEWLINE (parse nl "\n\r\r\n"))
+;(test 'WHITESPACE (parse whitespace " \t aaaa aaa "))
+;(test 'COMMENT (parse comment "-- aasf ljalsfkjalsfdjalsfd\n"))
+;
+;(test 'BLOCK-COMMENT ;; TODO: Check greediness
+; (parse comment "[- aasfjal sfkjalsfdjalsfd\nashfajsdf\nsdfasf-]"))
+;
+;(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"))
+;(test 'MULTI-WORD-COMPONENT (parse-fully component "un multi word{}"))
+;(test 'MULTI-WORD-COMPONENT (parse-fully component "un multi word{10}"))
+;(test 'MULTI-WORD-COMPONENT (parse-fully component "un multi word{10%l}"))
+;(test 'MULTI-WORD-COMPONENT (parse-fully component "un multi word{80%mm}"))
+;(test 'NO-NAME-TIMER (parse-fully timer "~{}"))
+;(test 'MULTI-WORD-TIMER (parse-fully timer "~un multi word{10}"))
+;(test 'MULTI-WORD-TIMER (parse-fully timer "~un multi word{10%l}"))
+;(test 'MULTI-WORD-TIMER (parse-fully timer "~un multi word{80%mm}"))
+;(test 'NO-NAME-TIMER (parse-fully timer "~{12%min}"))
+;(test 'INGREDIENT (parse-fully ingredient "@potato{12%kg}"))
+;(test 'STEP (parse-fully step "un poco de texto seguido de ~un multi word{10}"))
+;(test 'RECIPE (parse recipe "this is a recipe with @coconut{1}\nAnd takes ~{2%min}\n"))
+;(test 'RECIPE (parse recipe ">> some: metadata\nthis is a recipe with @coconut{1}\nAnd takes ~{2%min}\n"))