New tests

This commit is contained in:
Devine Lu Linvega 2024-04-23 13:29:30 -07:00
parent 083538ada8
commit c7aad6e21e
1 changed files with 44 additions and 52 deletions

View File

@ -1,44 +1,35 @@
?(?-) (This example tests various aspects of the implementation.) ?(?-) (This example tests various aspects of the implementation.)
?(?-) (Early Test Primitives)
<> (?x = ?x ?n test) (?(?: ?:) (#pass ?n\n))
<> (ghost) () <> (ghost) ()
?(?-) (Whitespace) ?(?-) (Whitespace)
(a b c ) = (a b c) test (a b c ) = (a b c) (whitespace 1) test
( a b c) = (a b c) test ( a b c) = (a b c) (whitespace 2) test
( a b c ) = (a b c) test ( a b c ) = (a b c) (whitespace 3) test
(a b c ( a b c ) ) = (a b c (a b c)) test (a b c ( a b c ) ) = (a b c (a b c)) (whitespace 4) test
?(?-) (Inline rules)
<> ((?x -> ?y)) (<> ?x ?y)
(nap -> (tap =))
nap tap test
?(?-) (Empty replacements) ?(?-) (Empty replacements)
(ab cd () ghost) = (ab cd ()) test (ab cd () ghost) = (ab cd ()) (empty 1) test
(ab cd ghost ()) = (ab cd ()) test (ab cd ghost ()) = (ab cd ()) (empty 2) test
(ab ghost cd ()) = (ab cd ()) test (ab ghost cd ()) = (ab cd ()) (empty 3) test
(ghost ab cd ()) = (ab cd ()) test (ghost ab cd ()) = (ab cd ()) (empty 4) test
(ghost) = () test (ghost) = () (empty 5) test
(q ?((?x ?y ?z) (?x ?y)) a b c) = (q a b) test (q ?((?x ?y ?z) (?x ?y)) a b c) = (q a b) (empty 6) test
(q ?((?x ?y ?z) (?x ?z)) a b c) = (q a c) test (q ?((?x ?y ?z) (?x ?z)) a b c) = (q a c) (empty 7) test
(q ?((?x ?y ?z) (?y ?z)) a b c) = (q b c) test (q ?((?x ?y ?z) (?y ?z)) a b c) = (q b c) (empty 8) test
<> (prefix/pop ?x) () <> (prefix/pop ?x) ()
<> (?x suffix/pop) () <> (?x suffix/pop) ()
(prefix/pop foo) = (ok) test (ab prefix/pop cd ef) = (ab ef) (empty 9) test
(foo suffix/pop) = (ok) test (ab cd suffix/pop ef) = (ab ef) (empty 10) test
?(?-) (Basic replacements)
<> (replace-name (foo)) ((bar) =)
replace-name (foo) (bar) test
?(?-) (Basic register setups) ?(?-) (Basic register setups)
@ -46,46 +37,36 @@ replace-name (foo) (bar) test
<> (swap (?x ?y)) (?y ?x) <> (swap (?x ?y)) (?y ?x)
<> (compare (?x ?x ?x)) (#t) <> (compare (?x ?x ?x)) (#t)
<> (rotate (?x (?y (?z)))) (?y (?z (?x))) <> (rotate (?x (?y (?z)))) (?y (?z (?x)))
<> (unused ?x) ?y
(dup (abc)) = (abc abc) test (dup (abc)) = (abc abc) (basic 1) test
(swap (abc def)) = (def abc) test (swap (abc def)) = (def abc) (basic 2) test
compare (abc abc abc) = #t test (compare (abc abc abc)) = (#t) (basic 3) test
(rotate (abc (def (ghi)))) = (def (ghi (abc))) test (rotate (abc (def (ghi)))) = (def (ghi (abc))) (basic 4) test
(unused hey) = (?y) (basic 5) test
?(?-) (Empty register replacement)
<> (replace-empty ?x) (?y)
replace-empty abc = ?y test
?(?-) (Substring registers) ?(?-) (Substring registers)
<> (connect ?x ?y ?z) (?x-?y?z) <> (connect ?x ?y ?z) (?x-?y?z)
<> (prefix-?x) (?x-suffix) <> (prefix-?x) (?x-suffix)
connect foo bar baz = foo-barbaz test connect foo bar baz = foo-barbaz (substring 1) test
prefix-anything = anything-suffix test prefix-anything = anything-suffix (substring 2) test
?(?-) (Lambdas) ?(?-) (Lambdas)
?(?x (?x ?x)) abc = (abc abc) test (?(?x (?x ?x)) abc) = (abc abc) (lambda 1) test
abc ?(?x) def = abc test abc ?(?x) def = abc (lambda 2) test
?(?-) (Explode) ?(?-) (Explode)
?(?* ?*) cow = (c (o (w ()))) test (?(?* ?*) cow) = (c (o (w ()))) (explode 1) test
?(?* ?*) (12 34 45) = (12 (34 (45 ()))) test (?(?* ?*) (12 34 45)) = (12 (34 (45 ()))) (explode 2) test
?(?-) (op: join) ?(?-) (op: join)
?(?^ ?^) (b (a (t ()))) = bat test ?(?^ ?^) (b (a (t ()))) = bat (join 1) test
?(?^ ?^) (12 (34 (56 ()))) = 123456 test ?(?^ ?^) (12 (34 (56 ()))) = 123456 (join 2) test
?(?-) (Test Primitives)
<> (?: print) (?:)
<> (?x = ?x test) (#ok\n print)
<> (?x = ?y test) (#fail\n print)
?(?-) (List reversal) ?(?-) (List reversal)
@ -93,4 +74,15 @@ abc ?(?x) def = abc test
<> (reverse (?*)) (reverse List (?*) ()) <> (reverse (?*)) (reverse List (?*) ())
<> (reverse List (?x ?y) ?z) (reverse List ?y (?x ?z)) <> (reverse List (?x ?y) ?z) (reverse List ?y (?x ?z))
reverse (modal) = ladom test reverse (modal) = ladom (reverse 1) test
?(?-) (Inline rules)
<> ((?x -> ?y)) (<> ?x ?y)
(nap -> (tap =))
nap tap (inline 1) test
?(?-) (Late Test Primitives)
<> (?x = ?y ?n test) (?(?: ?:) (#fail ?n found: ?x expect: ?y\n))