Fix test files (#163)

* Fix test files

* Fix
This commit is contained in:
Erik Schierboom
2024-04-30 14:10:56 +02:00
committed by GitHub
parent a865e843c2
commit 3212d8b6f9
42 changed files with 105 additions and 59 deletions

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -68,6 +68,14 @@ true var, run-test
l: =
;
: eps_eq? \ n x x -- T
\ are the items the same kind?
2dup >kind swap >kind n:=
!if 2drop false ;then
number? !if 2drop false ;then
rot n:~=
;
: check-depth \ ... n -- ...
dup>r
n:1+ depth n:=
@@ -109,6 +117,16 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec
4 check-depth
3dup \ so test-failed can show actual and expected
eps_eq?
if rot drop test-passed else rot drop test-failed then
;
: true? \ s w --
run-test? !if drop test-skipped ;; then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -12,6 +12,13 @@ true var, run-test
\ Some utility words
: test-passed \ s x x -- \\ test name, expected value, actual value
2drop
1 tests-passed n:+!
con:green con:onBlack . space " ... OK" . con:white con:onBlack cr
;
: test-skipped \ s --
1 tests-skipped n:+!
con:cyan con:onBlack . space " ... SKIPPED" . con:white con:onBlack cr
@@ -110,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -28,8 +28,8 @@ true var, run-test
1 tests-failed n:+!
rot
con:red con:onBlack . space " ... FAIL" . con:white con:onBlack cr
" Actual: «" . .
" Expected: «" . .
" Actual: «" . . "»" . cr
" Expected: «" . . "»" . cr cr
;
: isword? \ x -- x f
@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -12,6 +12,13 @@ true var, run-test
\ Some utility words
: test-passed \ s x x -- \\ test name, expected value, actual value
2drop
1 tests-passed n:+!
con:green con:onBlack . space " ... OK" . con:white con:onBlack cr
;
: test-skipped \ s --
1 tests-skipped n:+!
con:cyan con:onBlack . space " ... SKIPPED" . con:white con:onBlack cr
@@ -110,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -28,8 +28,8 @@ true var, run-test
1 tests-failed n:+!
rot
con:red con:onBlack . space " ... FAIL" . con:white con:onBlack cr
" Actual: «" . .
" Expected: «" . .
" Actual: «" . . "»" . cr
" Expected: «" . . "»" . cr cr
;
: isword? \ x -- x f
@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -12,6 +12,13 @@ true var, run-test
\ Some utility words
: test-passed \ s x x -- \\ test name, expected value, actual value
2drop
1 tests-passed n:+!
con:green con:onBlack . space " ... OK" . con:white con:onBlack cr
;
: test-skipped \ s --
1 tests-skipped n:+!
con:cyan con:onBlack . space " ... SKIPPED" . con:white con:onBlack cr
@@ -110,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -12,6 +12,13 @@ true var, run-test
\ Some utility words
: test-passed \ s x x -- \\ test name, expected value, actual value
2drop
1 tests-passed n:+!
con:green con:onBlack . space " ... OK" . con:white con:onBlack cr
;
: test-skipped \ s --
1 tests-skipped n:+!
con:cyan con:onBlack . space " ... SKIPPED" . con:white con:onBlack cr
@@ -21,8 +28,8 @@ true var, run-test
1 tests-failed n:+!
rot
con:red con:onBlack . space " ... FAIL" . con:white con:onBlack cr
" Actual: «" . .
" Expected: «" . .
" Actual: «" . . "»" . cr
" Expected: «" . . "»" . cr cr
;
: isword? \ x -- x f
@@ -110,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -12,13 +12,6 @@ true var, run-test
\ Some utility words
: array-insens-dot \ x -- \\ removes leading space on stringified arrays
dup >kind ns:a n:=
if
>s s:trim
then
.
;
: test-passed \ s x x -- \\ test name, expected value, actual value
2drop
@@ -35,8 +28,8 @@ true var, run-test
1 tests-failed n:+!
rot
con:red con:onBlack . space " ... FAIL" . con:white con:onBlack cr
" Actual: «" . array-insens-dot "»" . cr
" Expected: «" . array-insens-dot "»" . cr cr
" Actual: «" . . "»" . cr
" Expected: «" . . "»" . cr cr
;
: isword? \ x -- x f

View File

@@ -12,6 +12,13 @@ true var, run-test
\ Some utility words
: test-passed \ s x x -- \\ test name, expected value, actual value
2drop
1 tests-passed n:+!
con:green con:onBlack . space " ... OK" . con:white con:onBlack cr
;
: test-skipped \ s --
1 tests-skipped n:+!
con:cyan con:onBlack . space " ... SKIPPED" . con:white con:onBlack cr
@@ -21,8 +28,8 @@ true var, run-test
1 tests-failed n:+!
rot
con:red con:onBlack . space " ... FAIL" . con:white con:onBlack cr
" Actual: «" . .
" Expected: «" . .
" Actual: «" . . "»" . cr
" Expected: «" . . "»" . cr cr
;
: isword? \ x -- x f
@@ -110,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -28,8 +28,8 @@ true var, run-test
1 tests-failed n:+!
rot
con:red con:onBlack . space " ... FAIL" . con:white con:onBlack cr
" Actual: «" . .
" Expected: «" . .
" Actual: «" . . "»" . cr
" Expected: «" . . "»" . cr cr
;
: isword? \ x -- x f
@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec

View File

@@ -117,7 +117,7 @@ true var, run-test
eq? if test-passed else test-failed then
;
: approx_eaqual? \ s x w n -- | s w x n --
: approx_equal? \ s x w n -- | s w x n --
run-test? !if 3drop test-skipped ;; then
-rot isword? !if swap then
w:exec