prolog: write/1 + nl/0 via output buffer, 7 tests; built-ins box done
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -421,4 +421,78 @@
|
||||
(pl-mk-trail))
|
||||
false)
|
||||
|
||||
(pl-s-test!
|
||||
"write(hello)"
|
||||
(begin
|
||||
(pl-output-clear!)
|
||||
(pl-solve-once!
|
||||
pl-s-empty-db
|
||||
(pl-s-goal "write(hello)" {})
|
||||
(pl-mk-trail))
|
||||
pl-output-buffer)
|
||||
"hello")
|
||||
|
||||
(pl-s-test!
|
||||
"nl outputs newline"
|
||||
(begin
|
||||
(pl-output-clear!)
|
||||
(pl-solve-once! pl-s-empty-db (pl-s-goal "nl" {}) (pl-mk-trail))
|
||||
pl-output-buffer)
|
||||
"\n")
|
||||
|
||||
(pl-s-test!
|
||||
"write(42) outputs digits"
|
||||
(begin
|
||||
(pl-output-clear!)
|
||||
(pl-solve-once!
|
||||
pl-s-empty-db
|
||||
(pl-s-goal "write(42)" {})
|
||||
(pl-mk-trail))
|
||||
pl-output-buffer)
|
||||
"42")
|
||||
|
||||
(pl-s-test!
|
||||
"write(foo(a, b)) formats compound"
|
||||
(begin
|
||||
(pl-output-clear!)
|
||||
(pl-solve-once!
|
||||
pl-s-empty-db
|
||||
(pl-s-goal "write(foo(a, b))" {})
|
||||
(pl-mk-trail))
|
||||
pl-output-buffer)
|
||||
"foo(a, b)")
|
||||
|
||||
(pl-s-test!
|
||||
"write conjunction"
|
||||
(begin
|
||||
(pl-output-clear!)
|
||||
(pl-solve-once!
|
||||
pl-s-empty-db
|
||||
(pl-s-goal "write(a), write(b)" {})
|
||||
(pl-mk-trail))
|
||||
pl-output-buffer)
|
||||
"ab")
|
||||
|
||||
(pl-s-test!
|
||||
"write of bound var walks binding"
|
||||
(begin
|
||||
(pl-output-clear!)
|
||||
(pl-solve-once!
|
||||
pl-s-empty-db
|
||||
(pl-s-goal "=(X, hello), write(X)" {})
|
||||
(pl-mk-trail))
|
||||
pl-output-buffer)
|
||||
"hello")
|
||||
|
||||
(pl-s-test!
|
||||
"write then nl"
|
||||
(begin
|
||||
(pl-output-clear!)
|
||||
(pl-solve-once!
|
||||
pl-s-empty-db
|
||||
(pl-s-goal "write(hi), nl" {})
|
||||
(pl-mk-trail))
|
||||
pl-output-buffer)
|
||||
"hi\n")
|
||||
|
||||
(define pl-solve-tests-run! (fn () {:failed pl-s-test-fail :passed pl-s-test-pass :total pl-s-test-count :failures pl-s-test-failures}))
|
||||
|
||||
Reference in New Issue
Block a user