-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
title: ANSTESTSUITE | ||
gamecode: ANSF | ||
|
||
require ibm-font.fs | ||
require logger.fs | ||
require tester.fs | ||
|
||
variable #total | ||
: }T 1 #total +! }T ; | ||
|
||
: .progress | ||
scroll-to-bottom | ||
#total ? ." completed..." cr ; | ||
|
||
|
||
0 CONSTANT 0S | ||
0 INVERT CONSTANT 1S | ||
|
||
: GI1 IF 123 THEN ; | ||
: GI2 IF 123 ELSE 234 THEN ; | ||
|
||
: GI3 BEGIN DUP 5 < WHILE DUP 1+ REPEAT ; | ||
|
||
: GI4 BEGIN DUP 1+ DUP 5 > UNTIL ; | ||
|
||
: GI5 BEGIN DUP 2 > | ||
WHILE DUP 5 < WHILE DUP 1+ REPEAT 123 ELSE 345 THEN ; | ||
|
||
: run-tests | ||
log" BOOLEANS: INVERT AND OR XOR" | ||
|
||
T{ 0 0 AND -> 0 }T | ||
T{ 0 1 AND -> 0 }T | ||
T{ 1 0 AND -> 0 }T | ||
T{ 1 1 AND -> 1 }T .progress | ||
|
||
T{ 0 INVERT 1 AND -> 1 }T | ||
T{ 1 INVERT 1 AND -> 0 }T | ||
|
||
T{ 0S INVERT -> 1S }T | ||
T{ 1S INVERT -> 0S }T | ||
|
||
T{ 0S 0S AND -> 0S }T | ||
T{ 0S 1S AND -> 0S }T | ||
T{ 1S 0S AND -> 0S }T | ||
T{ 1S 1S AND -> 1S }T .progress | ||
|
||
T{ 0S 0S OR -> 0S }T | ||
T{ 0S 1S OR -> 1S }T | ||
T{ 1S 0S OR -> 1S }T | ||
T{ 1S 1S OR -> 1S }T | ||
|
||
T{ 0S 0S XOR -> 0S }T | ||
T{ 0S 1S XOR -> 1S }T | ||
T{ 1S 0S XOR -> 1S }T | ||
T{ 1S 1S XOR -> 0S }T .progress | ||
|
||
log" IF ELSE THEN BEGIN WHILE REPEAT UNTIL" | ||
|
||
T{ 0 GI1 -> }T | ||
T{ 1 GI1 -> 123 }T | ||
T{ -1 GI1 -> 123 }T | ||
T{ 0 GI2 -> 234 }T | ||
T{ 1 GI2 -> 123 }T | ||
T{ -1 GI1 -> 123 }T .progress | ||
|
||
T{ 0 GI3 -> 0 1 2 3 4 5 }T | ||
T{ 4 GI3 -> 4 5 }T | ||
T{ 5 GI3 -> 5 }T | ||
T{ 6 GI3 -> 6 }T | ||
|
||
T{ 3 GI4 -> 3 4 5 6 }T .progress | ||
T{ 5 GI4 -> 5 6 }T | ||
T{ 6 GI4 -> 6 7 }T | ||
|
||
T{ 1 GI5 -> 1 345 }T | ||
T{ 2 GI5 -> 2 345 }T | ||
T{ 3 GI5 -> 3 4 5 123 }T | ||
T{ 4 GI5 -> 4 5 123 }T | ||
T{ 5 GI5 -> 5 123 }T .progress | ||
; | ||
|
||
: main | ||
install-font | ||
init-term | ||
init-tester | ||
0 #total ! | ||
page | ||
run-tests | ||
log" --------------------" | ||
log" Test suite completed" cr | ||
#total @ 4 .r space ." total" cr | ||
#errors @ 4 .r space ." failures" | ||
cr scroll-to-bottom ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters