[arrayfire] 140/408: TEST: Updating and fixing the randu/randn tests

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.

commit b8cfd77440faa927d02945a915beefe20bcc7d5c
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Mon Jul 13 13:58:25 2015 -0400

    TEST: Updating and fixing the randu/randn tests
---
 test/random.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/random.cpp b/test/random.cpp
index 5d4f46c..fc5012e 100644
--- a/test/random.cpp
+++ b/test/random.cpp
@@ -162,22 +162,29 @@ void testSetSeed(const uintl seed0, const uintl seed1, bool is_norm = false)
 
     af::setSeed(seed0);
     af::array in2 = is_norm ? af::randn(num, ty) : af::randu(num, ty);
+    af::array in3 = is_norm ? af::randn(num, ty) : af::randu(num, ty);
 
     std::vector<T> h_in0(num);
     std::vector<T> h_in1(num);
     std::vector<T> h_in2(num);
+    std::vector<T> h_in3(num);
 
     in0.host((void *)&h_in0[0]);
     in1.host((void *)&h_in1[0]);
     in2.host((void *)&h_in2[0]);
+    in3.host((void *)&h_in3[0]);
 
     for (int i = 0; i < num; i++) {
         // Verify if same seed produces same arrays
         ASSERT_EQ(h_in0[i], h_in2[i]);
 
-        // Verify different arrays don't clash at same location
+        // Verify different arrays created with different seeds differ
         // b8 and u9 can clash because they generate a small set of values
         if (ty != b8 && ty != u8) ASSERT_NE(h_in0[i], h_in1[i]);
+
+        // Verify different arrays created one after the other with same seed differ
+        // b8 and u9 can clash because they generate a small set of values
+        if (ty != b8 && ty != u8) ASSERT_NE(h_in2[i], h_in3[i]);
     }
 }
 
@@ -188,7 +195,7 @@ TYPED_TEST(Random, setSeed)
 
 TYPED_TEST(Random_norm, setSeed)
 {
-    testSetSeed<TypeParam>(456, 789, false);
+    testSetSeed<TypeParam>(456, 789, true);
 }
 
 template<typename T>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list