From 36c38b7c86248aa25117a8db8c9e53fc40536f80 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 19 Jun 2012 23:11:10 -0700 Subject: [PATCH] 24-game: flush output, add some tests. --- extra/24-game/24-game-tests.factor | 6 ++++++ extra/24-game/24-game.factor | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 extra/24-game/24-game-tests.factor diff --git a/extra/24-game/24-game-tests.factor b/extra/24-game/24-game-tests.factor new file mode 100644 index 0000000000..daa93cb225 --- /dev/null +++ b/extra/24-game/24-game-tests.factor @@ -0,0 +1,6 @@ + +USING: 24-game sequences tools.test ; + +IN: 24-game.tests + +{ t } [ make-24 first4 makes-24? ] unit-test diff --git a/extra/24-game/24-game.factor b/extra/24-game/24-game.factor index b834299ac4..de9cfbeafc 100644 --- a/extra/24-game/24-game.factor +++ b/extra/24-game/24-game.factor @@ -42,7 +42,7 @@ CONSTANT: (operators) { + - * / rot swap q } [ name>> = ] with find nip ; : get-operator ( operators -- word ) - "Operators: " write dup pprint nl + "Operators: " write dup pprint nl flush readln over find-operator dup [ "Command not found..." print get-operator ] unless nip ;