knifin' around with random tester
parent
ca1e6f1f3f
commit
1822c6a153
|
@ -1,7 +1,8 @@
|
||||||
USING: compiler continuations io kernel math namespaces
|
USING: compiler continuations io kernel math namespaces
|
||||||
prettyprint quotations random sequences vectors
|
prettyprint quotations random sequences vectors
|
||||||
compiler.units ;
|
compiler.units ;
|
||||||
USING: random-tester.databank random-tester.safe-words ;
|
USING: random-tester.databank random-tester.safe-words
|
||||||
|
random-tester.random ;
|
||||||
IN: random-tester
|
IN: random-tester
|
||||||
|
|
||||||
SYMBOL: errored
|
SYMBOL: errored
|
||||||
|
@ -13,6 +14,8 @@ ERROR: random-tester-error ;
|
||||||
: setup-test ( #data #code -- data... quot )
|
: setup-test ( #data #code -- data... quot )
|
||||||
#! Variable stack effect
|
#! Variable stack effect
|
||||||
>r [ databank random ] times r>
|
>r [ databank random ] times r>
|
||||||
|
! 200 300 random-cond ;
|
||||||
|
! random-if ;
|
||||||
[ drop \ safe-words get random ] map >quotation ;
|
[ drop \ safe-words get random ] map >quotation ;
|
||||||
|
|
||||||
: test-compiler ! ( data... quot -- ... )
|
: test-compiler ! ( data... quot -- ... )
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
USING: kernel math sequences namespaces hashtables words
|
USING: kernel math sequences namespaces hashtables words
|
||||||
arrays parser compiler syntax io prettyprint optimizer
|
arrays parser compiler syntax io prettyprint random
|
||||||
random math.constants math.functions layouts random-tester.utils ;
|
math.constants math.functions layouts random-tester.utils
|
||||||
|
random-tester.safe-words quotations fry combinators ;
|
||||||
IN: random-tester
|
IN: random-tester
|
||||||
|
|
||||||
! Tweak me
|
! Tweak me
|
||||||
|
@ -72,3 +73,14 @@ IN: random-tester
|
||||||
: random-complex ( -- C )
|
: random-complex ( -- C )
|
||||||
random-number random-number rect> ;
|
random-number random-number rect> ;
|
||||||
|
|
||||||
|
: random-quot ( n -- quot )
|
||||||
|
[ \ safe-words get random ] replicate >quotation ;
|
||||||
|
|
||||||
|
: random-if ( n -- quot )
|
||||||
|
[ random-quot ] [ random-quot ] bi
|
||||||
|
'[ , , if ] ;
|
||||||
|
|
||||||
|
: random-cond ( m n -- quot )
|
||||||
|
[ '[ , [ random-quot ] [ random-quot ] bi 2array ] replicate ]
|
||||||
|
[ random-quot ] bi suffix
|
||||||
|
'[ , cond ] ;
|
||||||
|
|
|
@ -6,8 +6,6 @@ IN: random-tester.safe-words
|
||||||
|
|
||||||
: ?-words
|
: ?-words
|
||||||
{
|
{
|
||||||
delegate
|
|
||||||
|
|
||||||
/f
|
/f
|
||||||
|
|
||||||
bits>float bits>double
|
bits>float bits>double
|
||||||
|
|
Loading…
Reference in New Issue