[arrayfire] 23/34: Fix tests for 32-bit systems
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Sep 27 14:46:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.
commit fb9f2252f5aa739f9ecd7378604c7dea49808b63
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date: Wed Sep 23 19:13:50 2015 -0400
Fix tests for 32-bit systems
---
test/median.cpp | 23 ++++++++++++++++++++++-
test/reduce.cpp | 2 +-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/test/median.cpp b/test/median.cpp
index 86dee96..9f176dc 100644
--- a/test/median.cpp
+++ b/test/median.cpp
@@ -16,6 +16,27 @@
using namespace af;
using std::vector;
+template<typename Ti>
+af::array generateArray(int nx, int ny, int nz, int nw)
+{
+ array a = randu(nx, ny, nz, nw, (af::dtype)dtype_traits<Ti>::af_type);
+ return a;
+}
+
+template<>
+af::array generateArray<int>(int nx, int ny, int nz, int nw)
+{
+ array a = (randu(nx, ny, nz, nw, (af::dtype)dtype_traits<float>::af_type) * 1e6).as(s32);
+ return a;
+}
+
+template<>
+af::array generateArray<unsigned int>(int nx, int ny, int nz, int nw)
+{
+ array a = (randu(nx, ny, nz, nw, (af::dtype)dtype_traits<float>::af_type) * 1e6).as(u32);
+ return a;
+}
+
template<typename To, typename Ti, bool flat>
void median0(int nx, int ny=1, int nz=1, int nw=1)
{
@@ -49,7 +70,7 @@ void median0(int nx, int ny=1, int nz=1, int nw=1)
To left = h_sa[id + off * nx - 1];
To right = h_sa[id + off * nx];
- ASSERT_NEAR((left + right) / 2, h_b[off], 1e-8);
+ ASSERT_NEAR((left + right) / 2, h_b[off], 1e-5);
}
}
}
diff --git a/test/reduce.cpp b/test/reduce.cpp
index 45c0977..eef711d 100644
--- a/test/reduce.cpp
+++ b/test/reduce.cpp
@@ -256,7 +256,7 @@ TEST(Reduce, Test_Product_Global)
gold *= h_a[i];
}
- ASSERT_EQ(gold, res);
+ ASSERT_NEAR(gold, res, 1e-3);
delete[] h_a;
}
--
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