#138: unify test steps and test sheets (erase default)

This commit is contained in:
Louis Rubet 2017-06-16 23:44:48 +02:00
parent 52de16f958
commit 562ae5fdef
11 changed files with 208 additions and 180 deletions

View file

@ -1,38 +1,42 @@
## MODE
default
erase
default erase
# std (1)
erase
1
10 std
-> stack should be 1
erase
# std (2)
3 /
1 3 /
-> stack should be 0.3333333333
erase
# std (3)
3 std
1 3 / 3 std
-> stack should be 0.333
erase
# fix (1)
drop
10 fix
1
-> stack should be 1.0000000000
erase
# fix (2)
4 fix
1 4 fix
-> stack should be 1.0000
erase
# sci (1)
12 sci
1 12 sci
-> stack should be 1.000000000000e+00
erase
# sci (2)
2 sci
1 2 sci
-> stack should be 1.00e+00
drop
erase
default

View file

@ -1,34 +1,37 @@
## GENERAL
default
erase
default erase
# version
version
-> stack size should be 1
uname
-> stack size should be 2
erase
# type
1
type
uname
-> stack size should be 1
erase
# type (1)
1 type
-> stack should be 1, 'number'
erase
"hey"
type
# type (2)
"hey" type
-> stack should be "hey", 'string'
erase
<< -> n << n >> >>
type
# type (3)
<< -> n << n >> >> type
-> stack should be << -> n << n >> >>, 'program'
erase
# type (4)
(1,2) type
-> stack should be (1,2)), 'complex'
erase
# default
2 sci
1
2 sci 1
-> stack should be 1.00e+00
default
-> stack should be 1
@ -38,3 +41,4 @@ erase
nop
-> stack size should be 0
-> error should be 0
erase

View file

@ -1,4 +1,5 @@
## BRANCH
default erase
# if then else end (1)
1 if then 'ok' end

View file

@ -1,35 +1,38 @@
## STACK TEST
default erase
# entry depth (1)
1 depth
-> stack size should be 2
# entry depth (2)
erase depth
1 erase depth
-> stack should be 0
erase
# swap
erase
1 2 swap
-> stack size should be 2
-> stack should be 2, 1
erase
# swap with filled stack
erase
5 6 1 2 swap
-> stack size should be 4
-> stack should be 5, 6, 2, 1
erase
# swap error
erase
5 swap
-> stack size should be 1
-> error should 2
erase
# drop
erase
1 2 3 drop
-> stack size should be 2
-> stack should be 1, 2
erase
# drop2
3
@ -41,26 +44,29 @@ erase
# drop error
drop
-> error should be 2
erase
# drop2 error (1)
drop2
-> error should be 2
erase
# drop2 error (2)
1 drop2
-> error should be 2
drop
erase
# test dup
1 dup
-> stack size should be 2
-> stack should be 1, 1
erase
# test dup2
drop 2 dup2
1 2 dup2
-> stack size should be 4
-> stack should be 1, 2, 1, 2
drop2 drop2
erase
# test rot
1 2 3 rot
@ -89,7 +95,7 @@ erase
depth
-> stack size should be 4
-> stack should be 1, 2, 3, 3
erase
>erase
# test pick
1 2 3 4 2 pick
@ -99,74 +105,73 @@ erase
-> error should be 4
7 pick
-> error should be 4
erase
# test erase
erase
-> stack size should be 0
erase
# test dropn
erase
1 2 2 dropn
-> stack size should be 0
erase
# test dropn error
erase
1 2 3 dropn
-> stack size should be 3
-> error should be 2
erase
# test dupn
erase
1 2 3 4 3 dupn
-> stack should be 1, 2, 3, 4, 2, 3, 4
erase
# test dupn error
erase
1 2 3 4 5 dupn
-> stack size should be 5
-> error should be 2
erase
# test roll
erase
1 2 3 4 5 4 roll
-> stack should be 1, 3, 4, 5, 2
erase
# test roll with filled stack
erase
10 11 1 2 3 4 5 4 roll
-> stack should be 10, 11, 1, 3, 4, 5, 2
erase
# test roll error
erase
1 2 3 4 5 6 roll
-> stack size should be 6
-> error should be 2
erase
# test rolld
erase
10 20 30 40 50 3 rolld
-> stack should be 10, 20, 50, 30, 40
erase
# test rolld with filled stack
erase
80 90 10 20 30 40 50 3 rolld
-> stack should be 80, 90, 10, 20, 50, 30, 40
erase
# test rolld error
erase
1 2 3 4 5 6 rolld
-> stack size should be 6
-> error should be 2
erase
# test over
erase
3.14 15.16 over
-> stack should be 3.14, 15.16, 3.14
erase
# test over error
erase
2 over
-> stack size should be 1
-> error should be 2
erase

View file

@ -6,7 +6,7 @@ default erase
1
-> stack size should be 1
-> stack should be 1
drop
erase
# real decimal (2)
2.345
@ -22,8 +22,10 @@ erase
# real hex
0x1234 0x10.10
-> stack should be 0x1.234p+12, 0x1.01p+4
erase
# real hex (2)
0x1.234p+12, 0x1.01p+4
dec swap dec swap
-> stack should be 4660, 16.0625
erase
@ -54,16 +56,17 @@ erase
default
2 prec pi
-> stack should be 3
drop
erase
# prec (2)
10 prec pi
-> stack should be 3.140625
drop
erase
# prec error (1)
1 prec
-> error should be 4
erase
# prec error (2)
0x8000000000000000 prec
@ -103,91 +106,91 @@ erase default
# add (1)
1.2 2.3 +
-> stack should be 3.5
drop
erase
# add (2)
1.2 2.3+
-> stack should be 3.5
drop
erase
# add (3)
2.3 +
-> error should be 2
-> stack size should be 1
drop
erase
# add (4)
+
-> error should be 2
drop
erase
# sub (1)
1.2 2.3 -
-> stack should be -1.1
drop
erase
# sub (2)
1.2 2.3-
-> stack should be -1.1
drop
erase
# sub (3)
2.3 -
-> error should be 2
-> stack size should be 1
drop
erase
# sub (4)
-
-> error should be 2
drop
erase
# mul (1)
1.2 2.3 *
-> stack should be 2.76
drop
erase
# mul (2)
1.2 2.3*
-> stack should be 2.76
drop
erase
# mul (3)
2.3 *
-> error should be 2
-> stack size should be 1
drop
erase
# mul (4)
*
-> error should be 2
drop
erase
# div (1)
1.2 2.3 /
-> stack should be 0.5217391304347826087
drop
erase
# div (2)
1.2 2.3/
-> stack should be 0.5217391304347826087
drop
erase
# div (3)
2.3 /
-> error should be 2
-> stack size should be 1
drop
erase
# div (4)
/
-> error should be 2
drop
erase
# chs (1)
3.14 chs
-> stack should be -3.14
drop
erase
# chs (2)
chs
@ -196,7 +199,7 @@ chs
# neg (1)
3.14 neg
-> stack should be -3.14
drop
erase
# neg (2)
neg
@ -205,7 +208,7 @@ neg
# inv (1)
2 inv
-> stack should be 0.5
drop
erase
# inv (2)
inv
@ -225,12 +228,12 @@ erase
2 %
-> error should be 2
-> stack size should be 1
drop
erase
# % (4)
%
-> error should be 2
drop
erase
# %CH (1)
2 0.6 %CH
@ -246,12 +249,12 @@ erase
2 %CH
-> error should be 2
-> stack size should be 1
drop
erase
# %CH (4)
%CH
-> error should be 2
drop
erase
# ^ (1)
2 10 ^
@ -277,7 +280,7 @@ erase
# sqrt (1)
9 sqrt
-> stack should be 3
drop
erase
# sqrt (2)
sqrt
@ -286,7 +289,7 @@ sqrt
# sq (1)
12 sq
-> stack should be 144
drop
erase
# sq (2)
sq
@ -295,7 +298,7 @@ sq
# sqr (1)
12 sqr
-> stack should be 144
drop
erase
# sqr (2)
sqr

View file

@ -1,7 +1,5 @@
## STRING
default
erase
default erase
# string entry
"test string"
@ -25,33 +23,33 @@ erase
1
->str
-> stack should be "1"
drop
erase
# ->str on real (2)
1.234
25 std
->str
-> stack should be "1.234"
drop
erase
# ->str on real (3)
1.234
20 fix
->str
-> stack should be "1.23400000000000000000"
drop
erase
# ->str on symbol (1)
toto
->str
-> stack should be "'toto'"
drop
erase
# ->str on symbol (2)
'toto'
->str
-> stack should be "'toto'"
drop
erase
default
@ -59,7 +57,7 @@ default
"1"
str->
-> stack should be 1
drop
erase
# str-> on real (2)
"1 2.345 3 4.9"

View file

@ -1,96 +1,98 @@
## TESTS
default erase
# and (1)
and
-> error should be 2
1 and
-> error should be 2
drop
erase
# and (2)
0 0 and
-> stack size should be 1
-> stack should be 0
drop
erase
# and (3)
1 0 and
-> stack size should be 1
-> stack should be 0
drop
erase
# and (4)
0 1 and
-> stack size should be 1
-> stack should be 0
drop
erase
# and (5)
1 1 and
-> stack size should be 1
-> stack should be 1
drop
erase
# or (1)
or
-> error should be 2
1 or
-> error should be 2
drop
erase
# or (2)
0 0 or
-> stack size should be 1
-> stack should be 0
drop
erase
# or (3)
0 1 or
-> stack size should be 1
-> stack should be 1
drop
erase
# or (4)
1 0 or
-> stack size should be 1
-> stack should be 1
drop
erase
# or (5)
1 1 or
-> stack size should be 1
-> stack should be 1
drop
erase
# xor (1)
xor
-> error should be 2
1 xor
-> error should be 2
drop
erase
# xor (2)
0 0 xor
-> stack size should be 1
-> stack should be 0
drop
erase
# xor (3)
0 1 xor
-> stack size should be 1
-> stack should be 1
drop
erase
# xor (4)
1 0 xor
-> stack size should be 1
-> stack should be 1
drop
erase
# xor (5)
1 1 xor
-> stack size should be 1
-> stack should be 0
drop
erase
# not (1)
not
@ -98,146 +100,146 @@ not
1 not
-> stack size should be 1
-> stack should be 0
drop
erase
# not (2)
0 not
-> stack size should be 1
-> stack should be 1
drop
erase
# >
0 0.1 >
-> stack should be 0
drop
erase
0.1 0 >
-> stack should be 1
drop
erase
1 1 >
-> stack should be 0
drop
erase
# >=
0 0.1 >=
-> stack should be 0
drop
erase
0.1 0 >=
-> stack should be 1
drop
erase
1 1 >=
-> stack should be 1
drop
erase
# <
0 0.1 <
-> stack should be 1
drop
erase
0.1 0 <
-> stack should be 0
drop
erase
1 1 <
-> stack should be 0
drop
erase
# <=
0 0.1 <=
-> stack should be 1
drop
erase
0.1 0 <=
-> stack should be 0
drop
erase
1 1 <=
-> stack should be 1
drop
erase
# !=
0 0.1 !=
-> stack should be 1
drop
erase
1 1 !=
-> stack should be 0
drop
erase
# ==
0 0.1 ==
-> stack should be 0
drop
erase
1 1 ==
-> stack should be 1
drop
erase
# same
0 0.1 same
-> stack should be 0
drop
erase
1 1 same
-> stack should be 1
drop
erase
# string >
"a" "b" >
-> stack should be 0
drop
erase
"b" "a" >
-> stack should be 1
drop
erase
"a" "a" >
-> stack should be 0
drop
erase
# string >=
"a" "b" >=
-> stack should be 0
drop
erase
"b" "a" >=
-> stack should be 1
drop
erase
"a" "a" >=
-> stack should be 1
drop
erase
# string <
"a" "b" <
-> stack should be 1
drop
erase
"b" "a" <
-> stack should be 0
drop
erase
"a" "a" <
-> stack should be 0
drop
erase
# string <=
"a" "b" <=
-> stack should be 1
drop
erase
"b" "a" <=
-> stack should be 0
drop
erase
"a" "a" <=
-> stack should be 1
drop
erase
# string !=
"a" "b" !=
-> stack should be 1
drop
erase
"a" "a" !=
-> stack should be 0
drop
erase
# string ==
"a" "b" ==
-> stack should be 0
drop
erase
"a" "a" ==
-> stack should be 1
drop
erase
# string same
"a" "b" same
-> stack should be 0
drop
erase
"a" "a" same
-> stack should be 1
drop
erase

View file

@ -1,4 +1,5 @@
## STORE
default erase
# symbol entry
'test'

View file

@ -1,4 +1,5 @@
## PROGRAM
default erase
# program
<< 'one' >>
@ -52,3 +53,4 @@ erase
0 1 10 << -> u0 u1 n << u0 u1 1 n start dup2 + rot drop next swap drop >> >> eval
eval
-> stack should be 89
erase

View file

@ -25,7 +25,7 @@ erase
# entry (5)
(0x1234,0x10.10)
-> stack should be (0x1.234p+12,0x1.01p+4)
drop
erase
# entry (6)
(0b11,0b101)
@ -35,197 +35,197 @@ erase
# add (1)
(1.2,2.3) (1,2) +
-> stack should be (2.2,4.3)
drop
erase
# add (2)
(1.2,2.3) (1,2)+
-> stack should be (2.2,4.3)
drop
erase
# add (3)
(1.2,2.3) 3+
-> stack should be (4.2,2.3)
drop
erase
# add (4)
3 (1.2,2.3)+
-> stack should be (4.2,2.3)
drop
erase
# sub (1)
(1.2,2.3) (2,2) -
-> stack should be (-0.8,0.3)
drop
erase
# sub (2)
(1.2,2.3) (1,2)-
-> stack should be (0.2,0.3)
drop
erase
# sub (3)
(1.2,2.3) 1-
-> stack should be (0.2,2.3)
drop
erase
# sub (4)
1 (1.2,2.3) -
-> stack should be (-0.2,2.3)
drop
erase
# mul (1)
(1,2) (3,4) *
-> stack should be (-5,10)
drop
erase
# mul (2)
(3,4) (1,2) *
-> stack should be (-5,10)
drop
erase
# mul (3)
(3,4) 2 *
-> stack should be (6,8)
drop
erase
# mul (3)
2 (3,4) *
-> stack should be (6,8)
drop
erase
# div (1)
(1,2) (3,4) /
-> stack should be (0.44,0.08)
drop
erase
# div (2)
(1,2) 2 /
-> stack should be (0.5,1)
drop
erase
# div (3)
2 (3,4) /
-> stack should be (0.24,-0.32)
drop
erase
# re (1)
(1.2,3.4) re
-> stack should be 1.2
drop
erase
# re (2)
3 re
-> error should be 3
drop
erase
# re (3)
re
-> error should be 2
drop
erase
# im (1)
(1.2,3.4) im
-> stack should be 3.4
drop
erase
# im (2)
3 re
-> error should be 3
drop
erase
# im (3)
re
-> error should be 2
drop
erase
# chs
(3.14,6.28) chs
-> stack should be (-3.14,-6.28)
drop
erase
# neg
(-3.14,-6.28) neg
-> stack should be (3.14,6.28)
drop
erase
# inv (1)
(2,4) inv
-> stack should be (0.1,-0.2)
drop
erase
# inv (2)
(0.1,-0.2) inv
-> stack should be (2,4)
drop
erase
# abs
(3,4) abs
-> stack should be 5
drop
erase
# sign (1)
(1,0) sign
-> stack should be (1,0)
drop
erase
# sign (2)
(0,1) sign
-> stack should be (0,1)
drop
erase
# sign (3)
(3,-4) sign
-> stack should be (0.6,-0.8)
drop
erase
# sq (1)
(12,10) sq
-> stack should be (44,240)
drop
erase
# sqr (1)
(12,10) sq
-> stack should be (44,240)
drop
erase
# arg (1)
(1,1) arg pi 4 / ==
-> stack should be 1
drop
erase
# arg (2)
(-1,1) arg pi 3 * 4 / ==
-> stack should be 1
drop
erase
# arg (3)
(1,-1) arg -45 d->r ==
-> stack should be 1
drop
erase
# arg (4)
(-1,-1) arg pi -3 * 4 / ==
-> stack should be 1
drop
erase
# arg (5)
(1,0) arg 0 ==
-> stack should be 1
drop
erase
# arg (6)
(0,1) arg pi 2 / ==
-> stack should be 1
drop
erase
# arg (7)
(-1,0) arg pi ==
-> stack should be 1
drop
erase
# arg (8)
(0,-1) arg pi neg 2 / ==
-> stack should be 1
drop
erase
# conj
(1,2) conj dup conj
@ -240,12 +240,12 @@ erase
# r->c (2)
1 r->c
-> error should be 2
drop
erase
# r->c (3)
r->c
-> error should be 2
drop
erase
# r->c (3)
'1' '2' r->c

View file

@ -1,26 +1,34 @@
## MANUAL TESTS
erase
default erase
# GENERAL help
-> error should be 0
erase
# GENERAL h
-> error should be 0
erase
# GENERAL ?
-> error should be 0
erase
# GENERAL quit
-> error should be 0
erase
# GENERAL q
-> error should be 0
erase
# GENERAL exit
-> error should be 0
erase
# STORE vars
-> error should be 0
erase
# STORE edit
-> error should be 0
erase