]> gitweb.factorcode.org Git - factor.git/commitdiff
add random-exam for testing
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 31 May 2008 00:09:37 +0000 (19:09 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 31 May 2008 00:09:37 +0000 (19:09 -0500)
extra/db/tuples/tuples-tests.factor

index fa213efb2f98df95288a7ff4780b7d9da665a1b7..5c61a8f898a3113dd6d6d239646c6d0f02992e15 100755 (executable)
@@ -3,7 +3,8 @@
 USING: io.files kernel tools.test db db.tuples classes
 db.types continuations namespaces math math.ranges
 prettyprint calendar sequences db.sqlite math.intervals
-db.postgresql accessors random math.bitfields.lib ;
+db.postgresql accessors random math.bitfields.lib
+math.ranges strings sequences.lib ;
 IN: db.tuples.tests
 
 TUPLE: person the-id the-name the-number the-real
@@ -225,6 +226,12 @@ TUPLE: serialize-me id data ;
 
 TUPLE: exam id name score ; 
 
+: random-exam ( -- exam )
+        f
+        6 [ CHAR: a CHAR: b [a,b] random ] replicate >string
+        100 random
+    exam boa ;
+
 : test-intervals ( -- )
     exam "EXAM"
     {