[arrayfire] 142/408: TEST: Updating random tests to properly reset seeds
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 bd390834176581aab2e6924c417511ad29ac4f10
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Mon Jul 13 16:46:38 2015 -0400
TEST: Updating random tests to properly reset seeds
---
test/random.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/test/random.cpp b/test/random.cpp
index fc5012e..4ca5126 100644
--- a/test/random.cpp
+++ b/test/random.cpp
@@ -151,6 +151,8 @@ void testSetSeed(const uintl seed0, const uintl seed1, bool is_norm = false)
if (noDoubleTests<T>()) return;
+ uintl orig_seed = af::getSeed();
+
const int num = 1024 * 1024;
af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
@@ -186,6 +188,8 @@ void testSetSeed(const uintl seed0, const uintl seed1, bool is_norm = false)
// 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]);
}
+
+ af::setSeed(orig_seed); // Reset the seed
}
TYPED_TEST(Random, setSeed)
@@ -203,6 +207,8 @@ void testGetSeed(const uintl seed0, const uintl seed1)
{
if (noDoubleTests<T>()) return;
+ uintl orig_seed = af::getSeed();
+
const int num = 1024;
af::dtype ty = (af::dtype)af::dtype_traits<T>::af_type;
@@ -217,6 +223,8 @@ void testGetSeed(const uintl seed0, const uintl seed1)
af::setSeed(seed0);
af::array in2 = af::randu(num, ty);
ASSERT_EQ(af::getSeed(), seed0);
+
+ af::setSeed(orig_seed); // Reset the seed
}
TYPED_TEST(Random, getSeed)
--
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