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.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test logic logic.examples.factorial ;
IN: logic.examples.factorial.tests
{ { H{ { F 1 } } } } [ { factorial 0 F } query ] unit-test

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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