knifin' around with random tester

db4
Doug Coleman 2008-09-04 18:02:05 -05:00
parent ca1e6f1f3f
commit 1822c6a153
3 changed files with 18 additions and 5 deletions

View File

@ -1,7 +1,8 @@
USING: compiler continuations io kernel math namespaces
prettyprint quotations random sequences vectors
compiler.units ;
USING: random-tester.databank random-tester.safe-words ;
USING: random-tester.databank random-tester.safe-words
random-tester.random ;
IN: random-tester
SYMBOL: errored
@ -13,6 +14,8 @@ ERROR: random-tester-error ;
: setup-test ( #data #code -- data... quot )
#! Variable stack effect
>r [ databank random ] times r>
! 200 300 random-cond ;
! random-if ;
[ drop \ safe-words get random ] map >quotation ;
: test-compiler ! ( data... quot -- ... )

View File

@ -1,6 +1,7 @@
USING: kernel math sequences namespaces hashtables words
arrays parser compiler syntax io prettyprint optimizer
random math.constants math.functions layouts random-tester.utils ;
arrays parser compiler syntax io prettyprint random
math.constants math.functions layouts random-tester.utils
random-tester.safe-words quotations fry combinators ;
IN: random-tester
! Tweak me
@ -72,3 +73,14 @@ IN: random-tester
: random-complex ( -- C )
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 ] ;

View File

@ -6,8 +6,6 @@ IN: random-tester.safe-words
: ?-words
{
delegate
/f
bits>float bits>double