[arrayfire] 257/284: Changes required to build tests in a single file
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:39 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.
commit 41bad15c0cea1bbbea2ba540c212a63102500137
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Thu Jan 28 15:38:17 2016 -0500
Changes required to build tests in a single file
---
test/CMakeLists.txt | 48 +++++++++++++++++++++++++++++++++++++-----------
test/basic_c.c | 3 ++-
test/fast.cpp | 4 ++--
test/gloh_nonfree.cpp | 16 +++++++++-------
test/harris.cpp | 4 ++--
test/main.cpp | 6 ++++++
test/orb.cpp | 12 ++++++------
test/reduce.cpp | 10 ----------
test/rotate_linear.cpp | 14 +++++++-------
test/scan.cpp | 10 ----------
test/sift_nonfree.cpp | 17 +++++++++--------
test/sort_by_key.cpp | 13 ++++++-------
test/sort_index.cpp | 12 ++++++------
test/susan.cpp | 4 ++--
test/svd_dense.cpp | 4 ++--
test/testHelpers.hpp | 30 +++++++++++++++++-------------
test/where.cpp | 11 -----------
test/wrap.cpp | 10 +++++-----
18 files changed, 118 insertions(+), 110 deletions(-)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 1bcdde9..bea93d5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -6,6 +6,8 @@ SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
FIND_PACKAGE(CUDA QUIET)
FIND_PACKAGE(OpenCL QUIET)
+OPTION(BUILD_SINGLE_TEST_FILE "Build tests in a single file" OFF)
+
# If the tests are not being built at the same time as ArrayFire,
# we need to first find the ArrayFire library
IF(TARGET afcpu OR TARGET afcuda OR TARGET afopencl OR TARGET af)
@@ -58,14 +60,36 @@ MACRO(CREATE_TESTS BACKEND AFLIBNAME GTEST_LIBS OTHER_LIBS)
SET(TEST_FILES ${FILES})
ENDIF(${BACKEND} STREQUAL "unified")
- FOREACH(FILE ${TEST_FILES})
+ IF (${BUILD_SINGLE_TEST_FILE})
+ SET(TEST_NAME test_${BACKEND})
+ SET(TEST_NAME_BASIC test_basic_${BACKEND})
+ ADD_EXECUTABLE(${TEST_NAME} ${CPP_FILES})
+ ADD_EXECUTABLE(${TEST_NAME_BASIC} basic_c.c)
+
+ TARGET_LINK_LIBRARIES(${TEST_NAME} PRIVATE ${AFLIBNAME}
+ PRIVATE ${THREAD_LIB_FLAG}
+ PRIVATE ${GTEST_LIBS}
+ PRIVATE ${OTHER_LIBS})
+
+ TARGET_LINK_LIBRARIES(${TEST_NAME_BASIC} PRIVATE ${AFLIBNAME}
+ PRIVATE ${THREAD_LIB_FLAG}
+ PRIVATE ${GTEST_LIBS}
+ PRIVATE ${OTHER_LIBS})
+
+ SET_TARGET_PROPERTIES(${TEST_NAME_BASIC}
+ PROPERTIES
+ COMPILE_FLAGS -DAF_${DEF_NAME}
+ FOLDER "Tests/${BACKEND}")
+
+ ELSE()
+ FOREACH(FILE ${TEST_FILES})
GET_FILENAME_COMPONENT(FNAME ${FILE} NAME_WE)
SET(TEST_NAME ${FNAME}_${BACKEND})
IF(NOT ${BUILD_NONFREE} AND "${FILE}" MATCHES ".nonfree.")
- MESSAGE(STATUS "Removing ${FILE} from ctest")
+ MESSAGE(STATUS "Removing ${FILE} from ctest")
ELSEIF("${FILE}" MATCHES ".manual.")
- MESSAGE(STATUS "Removing ${FILE} from ctest")
+ MESSAGE(STATUS "Removing ${FILE} from ctest")
ELSE()
ADD_TEST(Test_${TEST_NAME} ${TEST_NAME})
ENDIF()
@@ -73,15 +97,16 @@ MACRO(CREATE_TESTS BACKEND AFLIBNAME GTEST_LIBS OTHER_LIBS)
FILE(GLOB TEST_FILE "${FNAME}.cpp" "${FNAME}.c")
ADD_EXECUTABLE(${TEST_NAME} ${TEST_FILE})
TARGET_LINK_LIBRARIES(${TEST_NAME} PRIVATE ${AFLIBNAME}
- PRIVATE ${THREAD_LIB_FLAG}
- PRIVATE ${GTEST_LIBS}
- PRIVATE ${OTHER_LIBS})
+ PRIVATE ${THREAD_LIB_FLAG}
+ PRIVATE ${GTEST_LIBS}
+ PRIVATE ${OTHER_LIBS})
SET_TARGET_PROPERTIES(${TEST_NAME}
- PROPERTIES
- COMPILE_FLAGS -DAF_${DEF_NAME}
- FOLDER "Tests/${BACKEND}")
- ENDFOREACH()
+ PROPERTIES
+ COMPILE_FLAGS -DAF_${DEF_NAME}
+ FOLDER "Tests/${BACKEND}")
+ ENDFOREACH()
+ ENDIF()
ENDMACRO(CREATE_TESTS)
@@ -136,10 +161,11 @@ INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
FILE(GLOB FILES "*.cpp" "*.c")
+FILE(GLOB CPP_FILES "*.cpp")
LIST(SORT FILES) # Tests execute in alphabetical order
# We only build backend.cpp for Unified backend
-SET(UNIFIED_FILES "backend.cpp")
+SET(UNIFIED_FILES "backend.cpp;main.cpp")
LIST(SORT UNIFIED_FILES) # Tests execute in alphabetical order
# Next we build each example using every backend.
diff --git a/test/basic_c.c b/test/basic_c.c
index 0caca29..aac34e1 100644
--- a/test/basic_c.c
+++ b/test/basic_c.c
@@ -9,7 +9,8 @@
#include <arrayfire.h>
-int main() {
+int main()
+{
af_array out = 0;
dim_t s[] = {10, 10, 1, 1};
af_err e = af_randu(&out, 4, s, f32);
diff --git a/test/fast.cpp b/test/fast.cpp
index e7df638..8cb9057 100644
--- a/test/fast.cpp
+++ b/test/fast.cpp
@@ -28,7 +28,7 @@ typedef struct
float f[5];
} feat_t;
-bool feat_cmp(feat_t i, feat_t j)
+static bool feat_cmp(feat_t i, feat_t j)
{
for (int k = 0; k < 5; k++)
if (i.f[k] != j.f[k])
@@ -37,7 +37,7 @@ bool feat_cmp(feat_t i, feat_t j)
return false;
}
-void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *orientation, float *size, unsigned nfeat)
+static void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *orientation, float *size, unsigned nfeat)
{
feat.resize(nfeat);
for (unsigned i = 0; i < feat.size(); i++) {
diff --git a/test/gloh_nonfree.cpp b/test/gloh_nonfree.cpp
index f50e403..5794051 100644
--- a/test/gloh_nonfree.cpp
+++ b/test/gloh_nonfree.cpp
@@ -39,7 +39,8 @@ typedef struct
float d[272];
} desc_t;
-bool feat_cmp(feat_desc_t i, feat_desc_t j)
+#ifdef AF_BUILD_NONFREE_SIFT
+static bool feat_cmp(feat_desc_t i, feat_desc_t j)
{
for (int k = 0; k < 5; k++)
if (round(i.f[k]*1e1f) != round(j.f[k]*1e1f))
@@ -48,7 +49,7 @@ bool feat_cmp(feat_desc_t i, feat_desc_t j)
return true;
}
-void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, float* desc, unsigned nfeat)
+static void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, float* desc, unsigned nfeat)
{
feat.resize(nfeat);
for (size_t i = 0; i < feat.size(); i++) {
@@ -62,7 +63,7 @@ void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* sc
}
}
-void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, vector<vector<float> >& desc, unsigned nfeat)
+static void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, vector<vector<float> >& desc, unsigned nfeat)
{
feat.resize(nfeat);
for (size_t i = 0; i < feat.size(); i++) {
@@ -76,7 +77,7 @@ void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* sc
}
}
-void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *ori, float *size, unsigned nfeat)
+static void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *ori, float *size, unsigned nfeat)
{
feat.resize(nfeat);
for (unsigned i = 0; i < feat.size(); i++) {
@@ -88,7 +89,7 @@ void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float
}
}
-void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>& d)
+static void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>& d)
{
f.resize(fd.size());
d.resize(fd.size());
@@ -103,7 +104,7 @@ void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>&
}
}
-unsigned popcount(unsigned x)
+static unsigned popcount(unsigned x)
{
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
@@ -113,7 +114,7 @@ unsigned popcount(unsigned x)
return x & 0x0000003F;
}
-bool compareEuclidean(dim_t desc_len, dim_t ndesc, float *cpu, float *gpu, float unit_thr = 1.f, float euc_thr = 1.f)
+static bool compareEuclidean(dim_t desc_len, dim_t ndesc, float *cpu, float *gpu, float unit_thr = 1.f, float euc_thr = 1.f)
{
bool ret = true;
float sum = 0.0f;
@@ -143,6 +144,7 @@ bool compareEuclidean(dim_t desc_len, dim_t ndesc, float *cpu, float *gpu, float
return ret;
}
+#endif
template<typename T>
class GLOH : public ::testing::Test
diff --git a/test/harris.cpp b/test/harris.cpp
index 604e73d..0adde6f 100644
--- a/test/harris.cpp
+++ b/test/harris.cpp
@@ -28,7 +28,7 @@ typedef struct
float f[5];
} feat_t;
-bool feat_cmp(feat_t i, feat_t j)
+static bool feat_cmp(feat_t i, feat_t j)
{
for (int k = 0; k < 5; k++)
if (i.f[k] != j.f[k])
@@ -37,7 +37,7 @@ bool feat_cmp(feat_t i, feat_t j)
return false;
}
-void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *orientation, float *size, unsigned nfeat)
+static void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *orientation, float *size, unsigned nfeat)
{
feat.resize(nfeat);
for (unsigned i = 0; i < feat.size(); i++) {
diff --git a/test/main.cpp b/test/main.cpp
new file mode 100644
index 0000000..76f841f
--- /dev/null
+++ b/test/main.cpp
@@ -0,0 +1,6 @@
+#include <gtest/gtest.h>
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
diff --git a/test/orb.cpp b/test/orb.cpp
index b499fb3..1266f20 100644
--- a/test/orb.cpp
+++ b/test/orb.cpp
@@ -39,7 +39,7 @@ typedef struct
unsigned d[8];
} desc_t;
-bool feat_cmp(feat_desc_t i, feat_desc_t j)
+static bool feat_cmp(feat_desc_t i, feat_desc_t j)
{
for (int k = 0; k < 5; k++)
if (i.f[k] != j.f[k])
@@ -48,7 +48,7 @@ bool feat_cmp(feat_desc_t i, feat_desc_t j)
return true;
}
-void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, unsigned* desc, unsigned nfeat)
+static void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, unsigned* desc, unsigned nfeat)
{
feat.resize(nfeat);
for (size_t i = 0; i < feat.size(); i++) {
@@ -62,7 +62,7 @@ void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* sc
}
}
-void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, vector<vector<unsigned> >& desc, unsigned nfeat)
+static void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, vector<vector<unsigned> >& desc, unsigned nfeat)
{
feat.resize(nfeat);
for (size_t i = 0; i < feat.size(); i++) {
@@ -76,7 +76,7 @@ void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* sc
}
}
-void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *ori, float *size, unsigned nfeat)
+static void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *ori, float *size, unsigned nfeat)
{
feat.resize(nfeat);
for (unsigned i = 0; i < feat.size(); i++) {
@@ -88,7 +88,7 @@ void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float
}
}
-void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>& d)
+static void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>& d)
{
f.resize(fd.size());
d.resize(fd.size());
@@ -103,7 +103,7 @@ void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>&
}
}
-unsigned popcount(unsigned x)
+static unsigned popcount(unsigned x)
{
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
diff --git a/test/reduce.cpp b/test/reduce.cpp
index f71dc76..675ed8f 100644
--- a/test/reduce.cpp
+++ b/test/reduce.cpp
@@ -109,16 +109,6 @@ void reduceTest(string pTestFile, int off = 0, bool isSubRef=false, const vector
ASSERT_EQ(AF_SUCCESS, af_release_array(inArray));
}
-vector<af_seq> init_subs()
-{
- vector<af_seq> subs;
- subs.push_back(af_make_seq(2, 6, 1));
- subs.push_back(af_make_seq(1, 5, 1));
- subs.push_back(af_make_seq(1, 3, 1));
- subs.push_back(af_make_seq(1, 2, 1));
- return subs;
-}
-
template<typename T,reduceFunc OP>
struct promote_type {
typedef T type;
diff --git a/test/rotate_linear.cpp b/test/rotate_linear.cpp
index ce7a921..15734a3 100644
--- a/test/rotate_linear.cpp
+++ b/test/rotate_linear.cpp
@@ -25,7 +25,7 @@ using af::cfloat;
using af::cdouble;
template<typename T>
-class Rotate : public ::testing::Test
+class RotateLinear : public ::testing::Test
{
public:
virtual void SetUp() {
@@ -40,7 +40,7 @@ class Rotate : public ::testing::Test
typedef ::testing::Types<float, double, cfloat, cdouble, int, intl, char, short> TestTypes;
// register the type list
-TYPED_TEST_CASE(Rotate, TestTypes);
+TYPED_TEST_CASE(RotateLinear, TestTypes);
#define PI 3.1415926535897931f
@@ -108,10 +108,10 @@ void rotateTest(string pTestFile, const unsigned resultIdx, const float angle, c
if(tempArray != 0) af_release_array(tempArray);
}
-#define ROTATE_INIT(desc, file, resultIdx, angle, crop, recenter) \
- TYPED_TEST(Rotate, desc) \
- { \
- rotateTest<TypeParam>(string(TEST_DIR"/rotate/"#file".test"), resultIdx, angle, crop, recenter);\
+#define ROTATE_INIT(desc, file, resultIdx, angle, crop, recenter) \
+ TYPED_TEST(RotateLinear, desc) \
+ { \
+ rotateTest<TypeParam>(string(TEST_DIR"/rotate/"#file".test"), resultIdx, angle, crop, recenter); \
}
ROTATE_INIT(Square180NoCropRecenter , rotatelinear1, 0, 180, false, true);
@@ -166,7 +166,7 @@ void rotateTest(string pTestFile, const unsigned resultIdx, const float angle, c
////////////////////////////////// CPP //////////////////////////////////////
-TEST(Rotate, CPP)
+TEST(RotateLinear, CPP)
{
if (noDoubleTests<float>()) return;
diff --git a/test/scan.cpp b/test/scan.cpp
index 386568d..34a077f 100644
--- a/test/scan.cpp
+++ b/test/scan.cpp
@@ -82,16 +82,6 @@ void scanTest(string pTestFile, int off = 0, bool isSubRef=false, const vector<a
ASSERT_EQ(AF_SUCCESS, af_release_array(inArray));
}
-vector<af_seq> init_subs()
-{
- vector<af_seq> subs;
- subs.push_back(af_make_seq(2, 6, 1));
- subs.push_back(af_make_seq(1, 5, 1));
- subs.push_back(af_make_seq(1, 3, 1));
- subs.push_back(af_make_seq(1, 2, 1));
- return subs;
-}
-
#define SCAN_TESTS(FN, TAG, Ti, To) \
TEST(Scan,Test_##FN##_##TAG) \
{ \
diff --git a/test/sift_nonfree.cpp b/test/sift_nonfree.cpp
index 2e069fd..6776c18 100644
--- a/test/sift_nonfree.cpp
+++ b/test/sift_nonfree.cpp
@@ -38,8 +38,8 @@ typedef struct
{
float d[128];
} desc_t;
-
-bool feat_cmp(feat_desc_t i, feat_desc_t j)
+#ifdef AF_BUILD_NONFREE_SIFT
+static bool feat_cmp(feat_desc_t i, feat_desc_t j)
{
for (int k = 0; k < 5; k++)
if (round(i.f[k]*1e1f) != round(j.f[k]*1e1f))
@@ -48,7 +48,7 @@ bool feat_cmp(feat_desc_t i, feat_desc_t j)
return true;
}
-void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, float* desc, unsigned nfeat)
+static void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, float* desc, unsigned nfeat)
{
feat.resize(nfeat);
for (size_t i = 0; i < feat.size(); i++) {
@@ -62,7 +62,7 @@ void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* sc
}
}
-void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, vector<vector<float> >& desc, unsigned nfeat)
+static void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* score, float* ori, float* size, vector<vector<float> >& desc, unsigned nfeat)
{
feat.resize(nfeat);
for (size_t i = 0; i < feat.size(); i++) {
@@ -76,7 +76,7 @@ void array_to_feat_desc(vector<feat_desc_t>& feat, float* x, float* y, float* sc
}
}
-void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *ori, float *size, unsigned nfeat)
+static void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *ori, float *size, unsigned nfeat)
{
feat.resize(nfeat);
for (unsigned i = 0; i < feat.size(); i++) {
@@ -88,7 +88,7 @@ void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float
}
}
-void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>& d)
+static void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>& d)
{
f.resize(fd.size());
d.resize(fd.size());
@@ -103,7 +103,7 @@ void split_feat_desc(vector<feat_desc_t>& fd, vector<feat_t>& f, vector<desc_t>&
}
}
-unsigned popcount(unsigned x)
+static unsigned popcount(unsigned x)
{
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
@@ -113,7 +113,7 @@ unsigned popcount(unsigned x)
return x & 0x0000003F;
}
-bool compareEuclidean(dim_t desc_len, dim_t ndesc, float *cpu, float *gpu, float unit_thr = 1.f, float euc_thr = 1.f)
+static bool compareEuclidean(dim_t desc_len, dim_t ndesc, float *cpu, float *gpu, float unit_thr = 1.f, float euc_thr = 1.f)
{
bool ret = true;
float sum = 0.0f;
@@ -143,6 +143,7 @@ bool compareEuclidean(dim_t desc_len, dim_t ndesc, float *cpu, float *gpu, float
return ret;
}
+#endif
template<typename T>
class SIFT : public ::testing::Test
diff --git a/test/sort_by_key.cpp b/test/sort_by_key.cpp
index 289e407..ed827c9 100644
--- a/test/sort_by_key.cpp
+++ b/test/sort_by_key.cpp
@@ -26,7 +26,7 @@ using af::cfloat;
using af::cdouble;
template<typename T>
-class Sort : public ::testing::Test
+class SortByKey : public ::testing::Test
{
public:
virtual void SetUp() {
@@ -41,7 +41,7 @@ class Sort : public ::testing::Test
typedef ::testing::Types<float, double, uint, int, uchar, short, ushort, intl, uintl> TestTypes;
// register the type list
-TYPED_TEST_CASE(Sort, TestTypes);
+TYPED_TEST_CASE(SortByKey, TestTypes);
template<typename T>
void sortTest(string pTestFile, const bool dir, const unsigned resultIdx0, const unsigned resultIdx1, bool isSubRef = false, const vector<af_seq> * seqv = NULL)
@@ -104,10 +104,10 @@ void sortTest(string pTestFile, const bool dir, const unsigned resultIdx0, const
if(tempArray != 0) af_release_array(tempArray);
}
-#define SORT_INIT(desc, file, dir, resultIdx0, resultIdx1) \
- TYPED_TEST(Sort, desc) \
- { \
- sortTest<TypeParam>(string(TEST_DIR"/sort/"#file".test"), dir, resultIdx0, resultIdx1); \
+#define SORT_INIT(desc, file, dir, resultIdx0, resultIdx1) \
+ TYPED_TEST(SortByKey, desc) \
+ { \
+ sortTest<TypeParam>(string(TEST_DIR"/sort/"#file".test"), dir, resultIdx0, resultIdx1); \
}
SORT_INIT(Sort0True, sort_by_key_tiny, true, 0, 1);
@@ -168,4 +168,3 @@ TEST(SortByKey, CPP)
delete[] keyData;
delete[] valData;
}
-
diff --git a/test/sort_index.cpp b/test/sort_index.cpp
index abe7910..6aa240d 100644
--- a/test/sort_index.cpp
+++ b/test/sort_index.cpp
@@ -26,7 +26,7 @@ using af::cfloat;
using af::cdouble;
template<typename T>
-class Sort : public ::testing::Test
+class SortIndex : public ::testing::Test
{
public:
virtual void SetUp() {
@@ -41,7 +41,7 @@ class Sort : public ::testing::Test
typedef ::testing::Types<float, double, uint, int, uchar, short, ushort, intl, uintl> TestTypes;
// register the type list
-TYPED_TEST_CASE(Sort, TestTypes);
+TYPED_TEST_CASE(SortIndex, TestTypes);
template<typename T>
void sortTest(string pTestFile, const bool dir, const unsigned resultIdx0, const unsigned resultIdx1, bool isSubRef = false, const vector<af_seq> * seqv = NULL)
@@ -102,10 +102,10 @@ void sortTest(string pTestFile, const bool dir, const unsigned resultIdx0, const
if(tempArray != 0) af_release_array(tempArray);
}
-#define SORT_INIT(desc, file, dir, resultIdx0, resultIdx1) \
- TYPED_TEST(Sort, desc) \
- { \
- sortTest<TypeParam>(string(TEST_DIR"/sort/"#file".test"), dir, resultIdx0, resultIdx1); \
+#define SORT_INIT(desc, file, dir, resultIdx0, resultIdx1) \
+ TYPED_TEST(SortIndex, desc) \
+ { \
+ sortTest<TypeParam>(string(TEST_DIR"/sort/"#file".test"), dir, resultIdx0, resultIdx1); \
}
SORT_INIT(Sort0True, sort, true, 0, 1);
diff --git a/test/susan.cpp b/test/susan.cpp
index 591c2f0..259a319 100644
--- a/test/susan.cpp
+++ b/test/susan.cpp
@@ -28,7 +28,7 @@ typedef struct
float f[5];
} feat_t;
-bool feat_cmp(feat_t i, feat_t j)
+static bool feat_cmp(feat_t i, feat_t j)
{
for (int k = 0; k < 5; k++)
if (i.f[k] != j.f[k])
@@ -37,7 +37,7 @@ bool feat_cmp(feat_t i, feat_t j)
return false;
}
-void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *orientation, float *size, unsigned nfeat)
+static void array_to_feat(vector<feat_t>& feat, float *x, float *y, float *score, float *orientation, float *size, unsigned nfeat)
{
feat.resize(nfeat);
for (unsigned i = 0; i < feat.size(); i++) {
diff --git a/test/svd_dense.cpp b/test/svd_dense.cpp
index 9d4060b..7ce31e2 100644
--- a/test/svd_dense.cpp
+++ b/test/svd_dense.cpp
@@ -35,12 +35,12 @@ typedef ::testing::Types<float, double, cfloat, cdouble> TestTypes;
TYPED_TEST_CASE(svd, TestTypes);
template<typename T>
-double get_val(T val)
+inline double get_val(T val)
{
return val;
}
-template<> double get_val<cfloat>(cfloat val)
+template<> inline double get_val<cfloat>(cfloat val)
{
return abs(val);
}
diff --git a/test/testHelpers.hpp b/test/testHelpers.hpp
index 2744a8d..83f2552 100644
--- a/test/testHelpers.hpp
+++ b/test/testHelpers.hpp
@@ -6,6 +6,8 @@
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-function"
#include <string>
#include <fstream>
@@ -127,11 +129,11 @@ void readTestsFromFile(const std::string &FileName, std::vector<af::dim4> &input
}
}
-void readImageTests(const std::string &pFileName,
- std::vector<af::dim4> &pInputDims,
- std::vector<std::string> &pTestInputs,
- std::vector<dim_t> &pTestOutSizes,
- std::vector<std::string> &pTestOutputs)
+inline void readImageTests(const std::string &pFileName,
+ std::vector<af::dim4> &pInputDims,
+ std::vector<std::string> &pTestInputs,
+ std::vector<dim_t> &pTestOutSizes,
+ std::vector<std::string> &pTestOutputs)
{
using std::vector;
@@ -364,18 +366,18 @@ struct cond_type<false, T, Other> {
};
template<typename T>
-double real(T val) { return (double)val; }
+inline double real(T val) { return (double)val; }
template<>
-double real<af::cdouble>(af::cdouble val) { return real(val); }
+inline double real<af::cdouble>(af::cdouble val) { return real(val); }
template<>
-double real<af::cfloat> (af::cfloat val) { return real(val); }
+inline double real<af::cfloat> (af::cfloat val) { return real(val); }
template<typename T>
-double imag(T val) { return (double)val; }
+inline double imag(T val) { return (double)val; }
template<>
-double imag<af::cdouble>(af::cdouble val) { return imag(val); }
+inline double imag<af::cdouble>(af::cdouble val) { return imag(val); }
template<>
-double imag<af::cfloat> (af::cfloat val) { return imag(val); }
+inline double imag<af::cfloat> (af::cfloat val) { return imag(val); }
template<typename T>
bool noDoubleTests()
@@ -388,14 +390,14 @@ bool noDoubleTests()
return ((isTypeDouble && !isDoubleSupported) ? true : false);
}
-bool noImageIOTests()
+inline bool noImageIOTests()
{
bool ret = !af::isImageIOAvailable();
if(ret) printf("Image IO Not Configured. Test will exit\n");
return ret;
}
-bool noLAPACKTests()
+inline bool noLAPACKTests()
{
bool ret = !af::isLAPACKAvailable();
if(ret) printf("LAPACK Not Configured. Test will exit\n");
@@ -450,3 +452,5 @@ af::array cpu_randu(const af::dim4 dims)
return af::array(dims, (T *)&out[0]);
}
+
+#pragma GCC diagnostic pop
diff --git a/test/where.cpp b/test/where.cpp
index eb21e0d..37208f2 100644
--- a/test/where.cpp
+++ b/test/where.cpp
@@ -78,17 +78,6 @@ void whereTest(string pTestFile, bool isSubRef=false, const vector<af_seq> seqv=
if(tempArray != 0) af_release_array(tempArray);
}
-vector<af_seq> init_subs()
-{
- vector<af_seq> subs;
- subs.push_back(af_make_seq(2, 6, 1));
- subs.push_back(af_make_seq(1, 5, 1));
- subs.push_back(af_make_seq(1, 3, 1));
- subs.push_back(af_make_seq(1, 2, 1));
- return subs;
-}
-
-
#define WHERE_TESTS(T) \
TEST(Where,Test_##T) \
{ \
diff --git a/test/wrap.cpp b/test/wrap.cpp
index 7552400..091c534 100644
--- a/test/wrap.cpp
+++ b/test/wrap.cpp
@@ -42,27 +42,27 @@ typedef ::testing::Types<float, double, cfloat, cdouble, int, unsigned int, intl
TYPED_TEST_CASE(Wrap, TestTypes);
template<typename T>
-double get_val(T val)
+inline double get_val(T val)
{
return val;
}
-template<> double get_val<cfloat>(cfloat val)
+template<> inline double get_val<cfloat>(cfloat val)
{
return abs(val);
}
-template<> double get_val<cdouble>(cdouble val)
+template<> inline double get_val<cdouble>(cdouble val)
{
return abs(val);
}
-template<> double get_val<unsigned char>(unsigned char val)
+template<> inline double get_val<unsigned char>(unsigned char val)
{
return ((int)(val)) % 256;
}
-template<> double get_val<char>(char val)
+template<> inline double get_val<char>(char val)
{
return (val != 0);
}
--
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