logic.examples: cleanup, make hanoi tests assert output.

master
John Benediktsson 2020-03-03 08:09:52 -08:00
parent 4ecc1110c8
commit ab81a957c9
10 changed files with 27 additions and 40 deletions

View File

@ -1,7 +1,6 @@
! Copyright (C) 2019-2020 KUSUMOTO Norio. ! Copyright (C) 2019-2020 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic logic.examples.factorial ; USING: tools.test logic logic.examples.factorial ;
IN: logic.examples.factorial.tests
{ { H{ { F 1 } } } } [ { factorial 0 F } query ] unit-test { { H{ { F 1 } } } } [ { factorial 0 F } query ] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2019-2020 KUSUMOTO Norio. ! Copyright (C) 2019-2020 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic lists logic.examples.fib ; USING: tools.test logic lists logic.examples.fib ;
IN: logic.examples.fib.tests
{ { H{ { L L{ 0 } } } } } [ { fibo 0 L } query ] unit-test { { H{ { L L{ 0 } } } } } [ { fibo 0 L } query ] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2019 KUSUMOTO Norio. ! Copyright (C) 2019 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic logic.examples.fib2 ; USING: tools.test logic logic.examples.fib2 ;
IN: logic.examples.fib2.tests
{ { H{ { F 6765 } } } } [ { { H{ { F 6765 } } } } [
{ fibo 20 F } query { fibo 20 F } query

View File

@ -1,20 +1,16 @@
! Copyright (C) 2019-2020 KUSUMOTO Norio. ! Copyright (C) 2019-2020 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic logic.examples.hanoi USING: io.streams.string literals logic logic.examples.hanoi
formatting sequences ; multiline tools.test ;
IN: logic.examples.hanoi.tests
{ t } [ ${
{ t [=[ move disk from left to center
"The following statements will be printed:" move disk from left to right
"move disk from left to center" move disk from center to right
"move disk from left to right" move disk from left to center
"move disk from center to right" move disk from right to left
"move disk from left to center" move disk from right to center
"move disk from right to left" move disk from left to center
"move disk from right to center" ]=] } [
"move disk from left to center" [ { hanoi 3 } query ] with-string-writer
" "
} [ "%s\n" printf ] each
{ hanoi 3 } query
] unit-test ] unit-test

View File

@ -1,20 +1,18 @@
! Copyright (C) 2019-2020 KUSUMOTO Norio. ! Copyright (C) 2019-2020 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic lists logic.examples.hanoi2 USING: io.streams.string multiline logic lists
formatting sequences ; logic.examples.hanoi2 sequences tools.test ;
IN: logic.examples.hanoi2.tests
{ t } [ {
{ t [=[ move Top from Left to Center
"The following statements will be printed:" move 2nd from Left to Right
"move Top from Left to Center" move Top from Center to Right
"move 2nd from Left to Right" move Base from Left to Center
"move Top from Center to Right" move Top from Right to Left
"move Base from Left to Center" move 2nd from Right to Center
"move Top from Right to Left" move Top from Left to Center
"move 2nd from Right to Center" ]=] } [
"move Top from Left to Center" [
" " { hanoi L{ "Base" "2nd" "Top" } "Left" "Center" "Right" } query
} [ "%s\n" printf ] each ] with-string-writer
{ hanoi L{ "Base" "2nd" "Top" } "Left" "Center" "Right" } query
] unit-test ] unit-test

View File

@ -1,7 +1,6 @@
! Copyright (C) 2019-2020 KUSUMOTO Norio. ! Copyright (C) 2019-2020 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic lists logic.examples.money ; USING: tools.test logic lists logic.examples.money ;
IN: logic.examples.money.tests
{ {
{ {

View File

@ -1,7 +1,6 @@
! Copyright (C) 2019 Your name. ! Copyright (C) 2019 Your name.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic logic.examples.zebra-short ; USING: tools.test logic logic.examples.zebra-short ;
IN: logic.examples.zebra-short.tests
{ {
{ H{ { X japanese } } H{ { X japanese } } } { H{ { X japanese } } H{ { X japanese } } }

View File

@ -1,6 +1,6 @@
! Copyright (C) 2019 KUSUMOTO Norio. ! Copyright (C) 2019 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: logic arrays ; USING: logic lists ;
IN: logic.examples.zebra-short IN: logic.examples.zebra-short
! Do the same as this Prolog program ! Do the same as this Prolog program

View File

@ -1,7 +1,6 @@
! Copyright (C) 2019-2020 KUSUMOTO Norio. ! Copyright (C) 2019-2020 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic lists logic.examples.zebra ; USING: tools.test logic lists logic.examples.zebra ;
IN: logic.examples.zebra.tests
{ {
{ {

View File

@ -1,7 +1,6 @@
! Copyright (C) 2019-2020 KUSUMOTO Norio. ! Copyright (C) 2019-2020 KUSUMOTO Norio.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic lists logic.examples.zebra2 ; USING: tools.test logic lists logic.examples.zebra2 ;
IN: logic.examples.zebra2.tests
{ {
{ {