Skip to content

Commit 0603b90

Browse files
committed
unify tests/ hashing libs, giving old API functions unique names
1 parent c5e978a commit 0603b90

File tree

173 files changed

+166
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+166
-292
lines changed

tests/array/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ function(zfp_add_cpp_tests dims type bits)
33
set(test_name testArray${dims}${type})
44
add_executable(${test_name} ${test_name}.cpp)
55
target_link_libraries(${test_name}
6-
gtest gtest_main zfp hash${bits}Lib genSmoothRandNumsLib zfpChecksumsLib)
6+
gtest gtest_main zfp zfpHashLib genSmoothRandNumsLib zfpChecksumsLib)
77
add_test(NAME ${test_name} COMMAND ${test_name})
88

99
# test class's references
1010
set(test_name testArray${dims}${type}Refs)
1111
add_executable(${test_name} ${test_name}.cpp)
1212
target_link_libraries(${test_name}
13-
gtest gtest_main zfp hash${bits}Lib rand${bits}Lib)
13+
gtest gtest_main zfp zfpHashLib rand${bits}Lib)
1414
add_test(NAME ${test_name} COMMAND ${test_name})
1515

1616
# test class's pointers

tests/array/testArray1d.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using namespace zfp;
33

44
extern "C" {
55
#include "constants/1dDouble.h"
6-
#include "utils/hash64.h"
76
}
87

98
#include "gtest/gtest.h"

tests/array/testArray1dRefs.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash64.h"
65
#include "utils/rand64.h"
76
}
87

tests/array/testArray1dViews.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash64.h"
65
#include "utils/rand64.h"
76
}
87

tests/array/testArray1f.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using namespace zfp;
33

44
extern "C" {
55
#include "constants/1dFloat.h"
6-
#include "utils/hash32.h"
76
}
87

98
#include "gtest/gtest.h"

tests/array/testArray1fRefs.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash32.h"
65
#include "utils/rand32.h"
76
}
87

tests/array/testArray1fViews.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash32.h"
65
#include "utils/rand32.h"
76
}
87

tests/array/testArray2d.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using namespace zfp;
33

44
extern "C" {
55
#include "constants/2dDouble.h"
6-
#include "utils/hash64.h"
76
}
87

98
#include "gtest/gtest.h"

tests/array/testArray2dRefs.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash64.h"
65
#include "utils/rand64.h"
76
}
87

tests/array/testArray2dViews.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash64.h"
65
#include "utils/rand64.h"
76
}
87

tests/array/testArray2f.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using namespace zfp;
33

44
extern "C" {
55
#include "constants/2dFloat.h"
6-
#include "utils/hash32.h"
76
}
87

98
#include "gtest/gtest.h"

tests/array/testArray2fRefs.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash32.h"
65
#include "utils/rand32.h"
76
}
87

tests/array/testArray2fViews.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash32.h"
65
#include "utils/rand32.h"
76
}
87

tests/array/testArray3d.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using namespace zfp;
33

44
extern "C" {
55
#include "constants/3dDouble.h"
6-
#include "utils/hash64.h"
76
}
87

98
#include "gtest/gtest.h"

tests/array/testArray3dRefs.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash64.h"
65
#include "utils/rand64.h"
76
}
87

tests/array/testArray3dViews.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash64.h"
65
#include "utils/rand64.h"
76
}
87

tests/array/testArray3f.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ using namespace zfp;
33

44
extern "C" {
55
#include "constants/3dFloat.h"
6-
#include "utils/hash32.h"
76
}
87

98
#include "gtest/gtest.h"

tests/array/testArray3fRefs.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash32.h"
65
#include "utils/rand32.h"
76
}
87

tests/array/testArray3fViews.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using namespace zfp;
33

44
extern "C" {
5-
#include "utils/hash64.h"
65
#include "utils/rand64.h"
76
}
87

tests/array/testArrayBase.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
extern "C" {
2+
#include "utils/testMacros.h"
23
#include "utils/zfpChecksums.h"
4+
#include "utils/zfpHash.h"
35
}
46

57
TEST_F(TEST_FIXTURE, when_constructorCalled_then_rateSetWithWriteRandomAccess)
@@ -66,7 +68,7 @@ TEST_F(TEST_FIXTURE, when_setRate_then_compressionRateChanged)
6668

6769
TEST_F(TEST_FIXTURE, when_generateRandomData_then_checksumMatches)
6870
{
69-
EXPECT_PRED_FORMAT2(ExpectEqPrintHexPred, getChecksumOriginalDataArray(DIMS, ZFP_TYPE), hashArray((UINT*)inputDataArr, inputDataTotalLen, 1));
71+
EXPECT_PRED_FORMAT2(ExpectEqPrintHexPred, getChecksumOriginalDataArray(DIMS, ZFP_TYPE), _catFunc2(hashArray, SCALAR_BITS)((UINT*)inputDataArr, inputDataTotalLen, 1));
7072
}
7173

7274
#if DIMS == 1
@@ -110,7 +112,7 @@ TEST_P(TEST_FIXTURE, given_setArray_when_get_then_decompressedValsReturned)
110112
arr.get(decompressedArr);
111113

112114
uint64 expectedChecksum = getChecksumDecompressedArray(DIMS, ZFP_TYPE, zfp_mode_fixed_rate, GetParam());
113-
uint64 checksum = hashArray((UINT*)decompressedArr, inputDataTotalLen, 1);
115+
uint64 checksum = _catFunc2(hashArray, SCALAR_BITS)((UINT*)decompressedArr, inputDataTotalLen, 1);
114116
EXPECT_PRED_FORMAT2(ExpectEqPrintHexPred, expectedChecksum, checksum);
115117

116118
delete[] decompressedArr;

tests/array/testArrayRefsBase.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#include "gtest/gtest.h"
22
#include "utils/predicates.h"
33

4+
extern "C" {
5+
#include "utils/zfpHash.h"
6+
}
7+
48
// assumes macros ARRAY_DIMS_SCALAR_TEST, ARRAY_DIMS_SCALAR_TEST_REFS defined
59
class ARRAY_DIMS_SCALAR_TEST_REFS : public ARRAY_DIMS_SCALAR_TEST {};
610

tests/cfp/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function(cfp_add_test dims type bits)
22
set(test_name testCfpArray${dims}${type})
33
add_executable(${test_name} ${test_name}.c)
44
target_link_libraries(${test_name}
5-
cmocka cfp hash${bits}Lib genSmoothRandNumsLib zfpChecksumsLib)
5+
cmocka cfp zfpHashLib genSmoothRandNumsLib zfpChecksumsLib)
66
add_test(NAME ${test_name} COMMAND ${test_name})
77
endfunction()
88

tests/cfp/testCfpArray1d.c

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "src/block1.h"
33

44
#include "constants/1dDouble.h"
5-
#include "utils/hash64.h"
65

76
#define CFP_ARRAY_TYPE cfp_array1d
87
#define SUB_NAMESPACE array1d

tests/cfp/testCfpArray1f.c

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "src/block1.h"
33

44
#include "constants/1dFloat.h"
5-
#include "utils/hash32.h"
65

76
#define CFP_ARRAY_TYPE cfp_array1f
87
#define SUB_NAMESPACE array1f

tests/cfp/testCfpArray2d.c

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "src/block2.h"
33

44
#include "constants/2dDouble.h"
5-
#include "utils/hash64.h"
65

76
#define CFP_ARRAY_TYPE cfp_array2d
87
#define SUB_NAMESPACE array2d

tests/cfp/testCfpArray2f.c

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "src/block2.h"
33

44
#include "constants/2dFloat.h"
5-
#include "utils/hash32.h"
65

76
#define CFP_ARRAY_TYPE cfp_array2f
87
#define SUB_NAMESPACE array2f

tests/cfp/testCfpArray3d.c

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "src/block3.h"
33

44
#include "constants/3dDouble.h"
5-
#include "utils/hash64.h"
65

76
#define CFP_ARRAY_TYPE cfp_array3d
87
#define SUB_NAMESPACE array3d

tests/cfp/testCfpArray3f.c

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include "src/block3.h"
33

44
#include "constants/3dFloat.h"
5-
#include "utils/hash32.h"
65

76
#define CFP_ARRAY_TYPE cfp_array3f
87
#define SUB_NAMESPACE array3f

tests/cfp/testCfpArray_source.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "utils/genSmoothRandNums.h"
1515
#include "utils/testMacros.h"
1616
#include "utils/zfpChecksums.h"
17+
#include "utils/zfpHash.h"
1718

1819
#define SIZE_X 20
1920
#define SIZE_Y 31
@@ -225,7 +226,7 @@ static void
225226
when_seededRandomSmoothDataGenerated_expect_ChecksumMatches(void **state)
226227
{
227228
struct setupVars *bundle = *state;
228-
UInt checksum = hashArray((const UInt*)bundle->dataArr, bundle->totalDataLen, 1);
229+
UInt checksum = _catFunc2(hashArray, SCALAR_BITS)((const UInt*)bundle->dataArr, bundle->totalDataLen, 1);
229230
uint64 expectedChecksum = getChecksumOriginalDataArray(DIMS, ZFP_TYPE);
230231
assert_int_equal(checksum, expectedChecksum);
231232
}
@@ -418,7 +419,7 @@ _catFunc3(given_, CFP_ARRAY_TYPE, _when_getArray_expect_decompressedArrChecksumM
418419
CFP_NAMESPACE.SUB_NAMESPACE.set_array(cfpArr, bundle->dataArr);
419420
CFP_NAMESPACE.SUB_NAMESPACE.get_array(cfpArr, bundle->decompressedArr);
420421

421-
UInt checksum = hashArray((UInt*)bundle->decompressedArr, bundle->totalDataLen, 1);
422+
UInt checksum = _catFunc2(hashArray, SCALAR_BITS)((UInt*)bundle->decompressedArr, bundle->totalDataLen, 1);
422423
uint64 expectedChecksum = getChecksumDecompressedArray(DIMS, ZFP_TYPE, zfp_mode_fixed_rate, bundle->paramNum);
423424
assert_int_equal(checksum, expectedChecksum);
424425
}

tests/constants/1dDouble.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "universalConsts.h"
2+
#include "doubleConsts.h"
23

3-
#define FL_PT_DATA
4-
#define ZFP_TYPE zfp_type_double
54
#define DIM_INT_STR 1dDouble

tests/constants/1dFloat.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "universalConsts.h"
2+
#include "floatConsts.h"
23

3-
#define FL_PT_DATA
4-
#define ZFP_TYPE zfp_type_float
54
#define DIM_INT_STR 1dFloat

tests/constants/1dInt32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "universalConsts.h"
2+
#include "int32Consts.h"
23

3-
#define ZFP_TYPE zfp_type_int32
44
#define DIM_INT_STR 1dInt32

tests/constants/1dInt64.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "universalConsts.h"
2+
#include "int64Consts.h"
23

3-
#define ZFP_TYPE zfp_type_int64
44
#define DIM_INT_STR 1dInt64

tests/constants/2dDouble.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "universalConsts.h"
2+
#include "doubleConsts.h"
23

3-
#define FL_PT_DATA
4-
#define ZFP_TYPE zfp_type_double
54
#define DIM_INT_STR 2dDouble

tests/constants/2dFloat.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "universalConsts.h"
2+
#include "floatConsts.h"
23

3-
#define FL_PT_DATA
4-
#define ZFP_TYPE zfp_type_float
54
#define DIM_INT_STR 2dFloat

tests/constants/2dInt32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "universalConsts.h"
2+
#include "int32Consts.h"
23

3-
#define ZFP_TYPE zfp_type_int32
44
#define DIM_INT_STR 2dInt32

tests/constants/2dInt64.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "universalConsts.h"
2+
#include "int64Consts.h"
23

3-
#define ZFP_TYPE zfp_type_int64
44
#define DIM_INT_STR 2dInt64

tests/constants/3dDouble.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "universalConsts.h"
2+
#include "doubleConsts.h"
23

3-
#define FL_PT_DATA
4-
#define ZFP_TYPE zfp_type_double
54
#define DIM_INT_STR 3dDouble

tests/constants/3dFloat.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "universalConsts.h"
2+
#include "floatConsts.h"
23

3-
#define FL_PT_DATA
4-
#define ZFP_TYPE zfp_type_float
54
#define DIM_INT_STR 3dFloat

tests/constants/3dInt32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "universalConsts.h"
2+
#include "int32Consts.h"
23

3-
#define ZFP_TYPE zfp_type_int32
44
#define DIM_INT_STR 3dInt32

tests/constants/3dInt64.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "universalConsts.h"
2+
#include "int64Consts.h"
23

3-
#define ZFP_TYPE zfp_type_int64
44
#define DIM_INT_STR 3dInt64

tests/constants/4dDouble.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "universalConsts.h"
2+
#include "doubleConsts.h"
23

3-
#define FL_PT_DATA
4-
#define ZFP_TYPE zfp_type_double
54
#define DIM_INT_STR 4dDouble

tests/constants/4dFloat.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "universalConsts.h"
2+
#include "floatConsts.h"
23

3-
#define FL_PT_DATA
4-
#define ZFP_TYPE zfp_type_float
54
#define DIM_INT_STR 4dFloat

tests/constants/4dInt32.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "universalConsts.h"
2+
#include "int32Consts.h"
23

3-
#define ZFP_TYPE zfp_type_int32
44
#define DIM_INT_STR 4dInt32

tests/constants/4dInt64.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#include "universalConsts.h"
2+
#include "int64Consts.h"
23

3-
#define ZFP_TYPE zfp_type_int64
44
#define DIM_INT_STR 4dInt64

tests/constants/doubleConsts.h

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define FL_PT_DATA
2+
#define SCALAR_BITS 64
3+
#define ZFP_TYPE zfp_type_double

tests/constants/floatConsts.h

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define FL_PT_DATA
2+
#define SCALAR_BITS 32
3+
#define ZFP_TYPE zfp_type_float

tests/constants/int32Consts.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define SCALAR_BITS 32
2+
#define ZFP_TYPE zfp_type_int32

tests/constants/int64Consts.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define SCALAR_BITS 64
2+
#define ZFP_TYPE zfp_type_int64

0 commit comments

Comments
 (0)