Added some if/when/unless testing
added some non-partial-evaluation tests with inter-compile-1cvs
parent
a0722fa3e0
commit
9c9589aac2
|
@ -112,16 +112,23 @@ IN: random-tester
|
|||
: 2float>float ( f f -- f ) ( -- word ) { * + - /f max min } ;
|
||||
: 2complex>complex ( c c -- c ) ( -- word ) { * + - /f } ;
|
||||
|
||||
: (random-integer-quotation) ( -- quot )
|
||||
random-integer ,
|
||||
max-length random-int
|
||||
[
|
||||
[
|
||||
[ integer>integer nth-rand , ]
|
||||
[ random-integer , 2integer>integer nth-rand , ]
|
||||
] do-one
|
||||
] times ;
|
||||
: random-integer-quotation ( -- quot )
|
||||
[
|
||||
random-integer ,
|
||||
max-length random-int
|
||||
[
|
||||
[
|
||||
[ integer>integer nth-rand , ]
|
||||
[ random-integer , 2integer>integer nth-rand , ]
|
||||
] do-one
|
||||
] times
|
||||
(random-integer-quotation)
|
||||
] [ ] make ;
|
||||
|
||||
: random-integer-quotation-1 ( -- quot )
|
||||
[
|
||||
(random-integer-quotation) 2integer>integer nth-rand ,
|
||||
] [ ] make ;
|
||||
|
||||
: (random-ratio-quotation) ( -- quot )
|
||||
|
@ -171,12 +178,19 @@ IN: random-tester
|
|||
|
||||
SYMBOL: last
|
||||
: interp-compile-check ( quot -- )
|
||||
! dup .
|
||||
dup .
|
||||
[ last set ] keep
|
||||
[ call ] keep compile-1
|
||||
2dup swap unparse write " " write unparse print
|
||||
= [ "problem in math" throw ] unless ;
|
||||
|
||||
: interp-compile-check-1 ( quot -- )
|
||||
dup .
|
||||
[ last set ] keep
|
||||
[ call ] 2keep compile-1
|
||||
2dup swap unparse write " " write unparse print
|
||||
= [ "problem in math" throw ] unless ;
|
||||
|
||||
: interp-compile-check* ( quot -- )
|
||||
dup .
|
||||
>r 100 200 300 400 r> [ call 4array ] keep
|
||||
|
|
|
@ -5,7 +5,7 @@ USING: optimizer compiler-frontend compiler-backend inference ;
|
|||
IN: random-tester
|
||||
|
||||
! Tweak me
|
||||
: max-length 5 ; inline
|
||||
: max-length 7 ; inline
|
||||
: max-value 1000000000 ; inline
|
||||
|
||||
: 10% ( -- bool ) 10 random-int 8 > ;
|
||||
|
|
Loading…
Reference in New Issue