! 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
! 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
! 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
! 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
! 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
- { hanoi L{ "Base" "2nd" "Top" } "Left" "Center" "Right" } query
+{
+ 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
! 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
{
{
! 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 } } }
! 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
! 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
{
{
! 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
{
{