mirror of
https://github.com/usatiuk/psil.git
synced 2025-10-28 18:57:48 +01:00
coffee!
This commit is contained in:
1
clitests/.gitignore
vendored
Normal file
1
clitests/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.res
|
||||
@@ -2,10 +2,19 @@
|
||||
(if (> a b) a b)
|
||||
)
|
||||
|
||||
(define (equal a b)
|
||||
(if (nil? a) (if (nil? b) 1 0)
|
||||
(if (atom a)
|
||||
(if (atom b) (= a b) 0)
|
||||
(if (atom b) 0 (if (equal (car a) (car b)) (equal (cdr a) (cdr b)) 0))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define (coffee-shop-impl times last cur max)
|
||||
(if (= times (nil))
|
||||
(getmax cur max)
|
||||
(if (= last (car times))
|
||||
(if (equal last (car times))
|
||||
(coffee-shop-impl (cdr times) last (+ cur 1) max)
|
||||
(coffee-shop-impl (cdr times) (car times) 1 (getmax cur max))
|
||||
)
|
||||
@@ -16,6 +25,23 @@
|
||||
(coffee-shop-impl times (nil) 0 0)
|
||||
)
|
||||
|
||||
(equal (nil) (nil))
|
||||
(equal (nil) ())
|
||||
(equal () (nil))
|
||||
(equal (nil) (quote()))
|
||||
(equal () (nil))
|
||||
(equal () (quote()))
|
||||
|
||||
(equal (quote(a))(quote()))
|
||||
(equal (quote(a)) ())
|
||||
(equal (quote(a)) (nil))
|
||||
|
||||
(equal (quote(a)) (quote(a.)))
|
||||
(equal (quote(a.)) (quote(a b)))
|
||||
|
||||
(equal (quote(a b)) (quote(a.b)))
|
||||
(equal (quote(a b)) (quote(a b)))
|
||||
|
||||
(coffee-shop (nil))
|
||||
(coffee-shop (quote( (8 0) (8 10) (8 10) (8 45) )))
|
||||
(coffee-shop (quote( (8 12) (10 11) (10 11) (15 15) (15 15) (15 15) (22 22) (22 22) (22 59) )))
|
||||
16
clitests/coffee.psil.ex
Normal file
16
clitests/coffee.psil.ex
Normal file
@@ -0,0 +1,16 @@
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
0
|
||||
1
|
||||
0
|
||||
2
|
||||
3
|
||||
@@ -1,3 +0,0 @@
|
||||
0
|
||||
2
|
||||
3
|
||||
@@ -3,8 +3,6 @@ cd "$(dirname "$0")"
|
||||
|
||||
FAILED=()
|
||||
|
||||
PSIL="../cmake-build-debug/src/psil"
|
||||
|
||||
for FILE in *.psil; do
|
||||
echo "TESTING $FILE"
|
||||
$PSIL -f $FILE --repl- > $FILE.res
|
||||
|
||||
Reference in New Issue
Block a user