diff --git a/contrib/random-tester/random-tester.factor b/contrib/random-tester/random-tester.factor index c8c04a719d..da82599d69 100644 --- a/contrib/random-tester/random-tester.factor +++ b/contrib/random-tester/random-tester.factor @@ -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 diff --git a/contrib/random-tester/random.factor b/contrib/random-tester/random.factor index baf1d6f556..b0bb619b31 100644 --- a/contrib/random-tester/random.factor +++ b/contrib/random-tester/random.factor @@ -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 > ;