]> gitweb.factorcode.org Git - factor.git/commitdiff
Added some if/when/unless testing
authorDoug Coleman <erg@trifocus.net>
Mon, 23 Jan 2006 06:03:40 +0000 (06:03 +0000)
committerDoug Coleman <erg@trifocus.net>
Mon, 23 Jan 2006 06:03:40 +0000 (06:03 +0000)
added some non-partial-evaluation tests with inter-compile-1

contrib/random-tester/random-tester.factor
contrib/random-tester/random.factor

index c8c04a719d7db3a0b83674a6ed9853e3aa451ebb..da82599d6957bc0b7f71bd38cf5031114be2c2ec 100644 (file)
@@ -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-quotation) ( -- quot )
+    random-integer ,
+    max-length random-int
     [
-        random-integer ,
-        max-length random-int
         [
-            [
-                [ integer>integer nth-rand , ]
-                [ random-integer , 2integer>integer nth-rand , ]
-            ] do-one
-        ] times
+            [ integer>integer nth-rand , ]
+            [ random-integer , 2integer>integer nth-rand , ]
+        ] do-one
+    ] times ;
+: random-integer-quotation ( -- quot )
+    [
+        (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
index baf1d6f556f51a1f16a92e0f2fe13f48e98500cd..b0bb619b3127955f8ed214200073245459eaefc4 100644 (file)
@@ -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 > ;