Changeset: 878d8343a2a7 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=878d8343a2a7
Modified Files:
        sql/test/pg_regress/Tests/random.sql
        sql/test/pg_regress/Tests/random.stable.out
Branch: default
Log Message:

Making tests more usable.


diffs (121 lines):

diff --git a/sql/test/pg_regress/Tests/random.sql 
b/sql/test/pg_regress/Tests/random.sql
--- a/sql/test/pg_regress/Tests/random.sql
+++ b/sql/test/pg_regress/Tests/random.sql
@@ -1,7 +1,8 @@
 --
 -- RANDOM
 -- Test the random function
---
+
+-- NOTE MonetDB does not support function random(). Instead use rand().
 
 -- count the number of tuples originally, should be 1000
 SELECT count(*) FROM onek;
@@ -9,13 +10,13 @@ SELECT count(*) FROM onek;
 -- pick three random rows, they shouldn't match
 -- !! MonetDB does not allow ORDER BY or LIMIT in subqueries (and views), so 
disabled this test
 -- (SELECT unique1 AS random
---   FROM onek ORDER BY random() LIMIT 1)
+--   FROM onek ORDER BY rand() LIMIT 1)
 -- INTERSECT
 -- (SELECT unique1 AS random
---   FROM onek ORDER BY random() LIMIT 1)
+--   FROM onek ORDER BY rand() LIMIT 1)
 -- INTERSECT
 -- (SELECT unique1 AS random
---   FROM onek ORDER BY random() LIMIT 1);
+--   FROM onek ORDER BY rand() LIMIT 1);
 
 -- count roughly 1/10 of the tuples
 -- this one causes an undetected error
@@ -23,7 +24,7 @@ CREATE TEMPORARY TABLE random_tbl( rando
  ON COMMIT PRESERVE ROWS;
 
 INSERT INTO random_tbl SELECT count(*) AS random 
-  FROM onek WHERE rand() < 1.0/10;
+  FROM onek WHERE rand() > 1.0/10;
 
 DROP TABLE random_tbl;
 
@@ -31,22 +32,22 @@ CREATE TEMPORARY TABLE random_tbl( rando
  ON COMMIT PRESERVE ROWS;
 
 INSERT INTO random_tbl SELECT count(*) AS random 
-  FROM onek WHERE rand() < 1.0/10;
+  FROM onek WHERE rand() > 1.0/10;
 
 -- select again, the count should be different
 INSERT INTO RANDOM_TBL (random)
   SELECT count(*)
-  FROM onek WHERE rand() < 1.0/10;
+  FROM onek WHERE rand() > 1.0/10;
 
 -- select again, the count should be different
 INSERT INTO RANDOM_TBL (random)
   SELECT count(*)
-  FROM onek WHERE rand() < 1.0/10;
+  FROM onek WHERE rand() > 1.0/10;
 
 -- select again, the count should be different
 INSERT INTO RANDOM_TBL (random)
   SELECT count(*)
-  FROM onek WHERE rand() < 1.0/10;
+  FROM onek WHERE rand() > 1.0/10;
 
 -- now test that they are different counts
 SELECT random, count(random) FROM RANDOM_TBL
diff --git a/sql/test/pg_regress/Tests/random.stable.out 
b/sql/test/pg_regress/Tests/random.stable.out
--- a/sql/test/pg_regress/Tests/random.stable.out
+++ b/sql/test/pg_regress/Tests/random.stable.out
@@ -38,27 +38,27 @@ Ready.
 #CREATE TEMPORARY TABLE random_tbl( random double)
 # ON COMMIT PRESERVE ROWS;
 #INSERT INTO random_tbl SELECT count(*) AS random 
-#  FROM onek WHERE rand() < 1.0/10;
+#  FROM onek WHERE rand() > 1.0/10;
 [ 1    ]
 #DROP TABLE random_tbl;
 #CREATE TEMPORARY TABLE random_tbl( random bigint)
 # ON COMMIT PRESERVE ROWS;
 #INSERT INTO random_tbl SELECT count(*) AS random 
-#  FROM onek WHERE rand() < 1.0/10;
+#  FROM onek WHERE rand() > 1.0/10;
 [ 1    ]
 #INSERT INTO RANDOM_TBL (random)
 #  SELECT count(*)
-#  FROM onek WHERE random() < 1.0/10;
+#  FROM onek WHERE rand() > 1.0/10;
 [ 1 ]
 #-- select again, the count should be different
 #INSERT INTO RANDOM_TBL (random)
 #  SELECT count(*)
-#  FROM onek WHERE random() < 1.0/10;
+#  FROM onek WHERE rand() > 1.0/10;
 [ 1 ]
 #-- select again, the count should be different
 #INSERT INTO RANDOM_TBL (random)
 #  SELECT count(*)
-#  FROM onek WHERE random() < 1.0/10;
+#  FROM onek WHERE rand() > 1.0/10;
 [ 1 ]
 #-- now test that they are different counts
 #SELECT random, count(random) FROM RANDOM_TBL
@@ -66,15 +66,15 @@ Ready.
 % tmp.random_tbl,      tmp.L1 # table_name
 % random,      L1 # name
 % bigint,      wrd # type
-% 1,   1 # length
-[ 0, 4       ]
+% 4,   1 # length
+[ 1000, 4       ]
 #SELECT AVG(random) FROM RANDOM_TBL
 #  HAVING AVG(random) NOT BETWEEN 80 AND 120;
 % .L1 # table_name
 % L1 # name
 % double # type
 % 24 # length
-[ 0  ]
+[ 1000  ]
 
 # 12:56:12 >  
 # 12:56:12 >  "Done."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to