tests: change 'rand' test for better portability
authorJean-Sebastien Gelinas <calestar@gmail.com>
Tue, 7 Jul 2009 19:24:56 +0000 (15:24 -0400)
committerJean Privat <jean@pryen.org>
Wed, 8 Jul 2009 16:32:46 +0000 (12:32 -0400)
Signed-off-by: Jean-Sebastien Gelinas <calestar@gmail.com>
Signed-off-by: Jean Privat <jean@pryen.org>

tests/sav/test_math.sav
tests/test_math.nit

index 6c34cda..fca4b99 100644 (file)
@@ -13,4 +13,3 @@
 0.100000
 0.100000
 0.100000
-0, 0.0, 0, 0.80030, 0, 0.159289, 0, 1.345366, 1, 3.576007, 0, 1.373251, 5, 1.327668, 2, 1.792959, 2, 2.174776, 3, 2.306186, 3, 4.612696, 
\ No newline at end of file
index 3f5dac0..8b9639d 100644 (file)
@@ -1,6 +1,7 @@
 # This file is part of NIT ( http://www.nitlanguage.org ).
 #
 # Copyright 2005-2008 Jean Privat <jean@pryen.org>
+# Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -34,7 +35,12 @@ print(0.1.sin.asin.sin.asin)
 print(0.1.tan.atan.tan.atan)
 print(0.1.exp.log.exp.log)
 
-for i in [0..10] do
-       printn(i.rand, ", ", i.to_f.rand, ", ")
+var random_int: Int
+var random_float: Float
+for i in [0..100] do
+       random_int = 1.rand
+       random_float = 1.0.rand
+       if random_int > 1 or random_int < 0 then print "Erroneous random int"
+       if random_float > 1.0 or random_float < 0.0 then print "Erroneous random float"
 end