diff options
67 files changed, 266 insertions, 129 deletions
diff --git a/include/compression/tng_compress_testing.h.in b/include/compression/tng_compress_testing.h.in new file mode 100644 index 0000000..168764b --- /dev/null +++ b/include/compression/tng_compress_testing.h.in @@ -0,0 +1,6 @@ +#ifndef TNG_COMPRESS_TESTING_H +#define TNG_COMPRESS_TESTING_H + +#define TNG_COMPRESS_FILES_DIR "@TNG_COMPRESS_FILES_DIR@" + +#endif diff --git a/src/tests/compression/CMakeLists.txt b/src/tests/compression/CMakeLists.txt index e69de29..15b059b 100644 --- a/src/tests/compression/CMakeLists.txt +++ b/src/tests/compression/CMakeLists.txt @@ -0,0 +1,36 @@ +link_directories(${TRAJECTORY_BINARY_DIR}/src/lib) + +set(TNG_COMPRESS_FILES_DIR ${CMAKE_BINARY_DIR}/test_tng_compress_files/ CACHE STRING "Directory where to write tng_compress test files.") + +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/test_tng_compress_files) +configure_file(${TRAJECTORY_SOURCE_DIR}/include/compression/tng_compress_testing.h.in ${CMAKE_BINARY_DIR}/generated/tng_compress_testing.h) + +include_directories(${CMAKE_SOURCE_DIR}/include/compression) +include_directories(${CMAKE_BINARY_DIR}/generated/) + +set(number 0) +set(numtests 59) + +while( number LESS ${numtests}) + +math( EXPR number "${number} + 1" ) + +add_executable(test_tng_compress_gen${number} testsuite.c) +target_link_libraries(test_tng_compress_gen${number} tng_compress m) +list(APPEND gen${number}_build_definitions GEN) +list(APPEND gen${number}_build_definitions TESTPARAM="test${number}.h") +set_target_properties(test_tng_compress_gen${number} PROPERTIES COMPILE_DEFINITIONS "${gen${number}_build_definitions}") +add_dependencies(test_tng_compress_gen${number} test${number}.h) + +add_executable(test_tng_compress_read${number} testsuite.c) +target_link_libraries(test_tng_compress_read${number} tng_compress m) +list(APPEND read${number}_build_definitions TESTPARAM="test${number}.h") +set_target_properties(test_tng_compress_read${number} PROPERTIES COMPILE_DEFINITIONS "${read${number}_build_definitions}") +add_dependencies(test_tng_compress_read${number} test${number}.h) + +endwhile() + +file(COPY test_tng_compress_write.sh DESTINATION ${CMAKE_BINARY_DIR}/bin) +file(COPY test_tng_compress_read.sh DESTINATION ${CMAKE_BINARY_DIR}/bin) +file(COPY test_tng_compress_write.bat DESTINATION ${CMAKE_BINARY_DIR}/bin) +file(COPY test_tng_compress_read.bat DESTINATION ${CMAKE_BINARY_DIR}/bin) diff --git a/src/tests/compression/test1.h b/src/tests/compression/test1.h index ad802e0..b45abc4 100644 --- a/src/tests/compression/test1.h +++ b/src/tests/compression/test1.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. Intra frame triple algorithm. Cubic cell." -#define FILENAME "test1.tng" +#define FILENAME "test1.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test10.h b/src/tests/compression/test10.h index 471dcab..d5135eb 100644 --- a/src/tests/compression/test10.h +++ b/src/tests/compression/test10.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. Triple intraframe algorithm. Cubic cell." -#define FILENAME "test10.tng" +#define FILENAME "test10.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test11.h b/src/tests/compression/test11.h index b9d7039..596d63c 100644 --- a/src/tests/compression/test11.h +++ b/src/tests/compression/test11.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. Triple one-to-one algorithm. Cubic cell." -#define FILENAME "test11.tng" +#define FILENAME "test11.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test12.h b/src/tests/compression/test12.h index 5d692d8..43eb15d 100644 --- a/src/tests/compression/test12.h +++ b/src/tests/compression/test12.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. BWLZH interframe algorithm. Cubic cell." -#define FILENAME "test12.tng" +#define FILENAME "test12.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test13.h b/src/tests/compression/test13.h index b650f91..72aa99e 100644 --- a/src/tests/compression/test13.h +++ b/src/tests/compression/test13.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. BWLZH intraframe algorithm. Cubic cell." -#define FILENAME "test13.tng" +#define FILENAME "test13.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test14.h b/src/tests/compression/test14.h index 0db6853..382c70e 100644 --- a/src/tests/compression/test14.h +++ b/src/tests/compression/test14.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. XTC3 algorithm. Cubic cell." -#define FILENAME "test14.tng" +#define FILENAME "test14.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test15.h b/src/tests/compression/test15.h index 35f94ba..c593bf5 100644 --- a/src/tests/compression/test15.h +++ b/src/tests/compression/test15.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. Automatic selection of algorithms. Cubic cell." -#define FILENAME "test15.tng" +#define FILENAME "test15.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test16.h b/src/tests/compression/test16.h index 5f972cb..a29c5e5 100644 --- a/src/tests/compression/test16.h +++ b/src/tests/compression/test16.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. Automatic selection of algorithms. Cubic cell." -#define FILENAME "test16.tng" +#define FILENAME "test16.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test17.h b/src/tests/compression/test17.h index 226e34c..9787976 100644 --- a/src/tests/compression/test17.h +++ b/src/tests/compression/test17.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding of velocities. Stopbits one-to-one . Cubic cell." -#define FILENAME "test17.tng" +#define FILENAME "test17.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test18.h b/src/tests/compression/test18.h index 1248a6d..5a329ad 100644 --- a/src/tests/compression/test18.h +++ b/src/tests/compression/test18.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding of velocities. Triplet one-to-one. Cubic cell." -#define FILENAME "test18.tng" +#define FILENAME "test18.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test19.h b/src/tests/compression/test19.h index ac09bc2..b298309 100644 --- a/src/tests/compression/test19.h +++ b/src/tests/compression/test19.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding of velocities. BWLZH one-to-one. Cubic cell." -#define FILENAME "test19.tng" +#define FILENAME "test19.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test2.h b/src/tests/compression/test2.h index f2a0f9a..0e2c3b0 100644 --- a/src/tests/compression/test2.h +++ b/src/tests/compression/test2.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. XTC2 algorithm. Cubic cell." -#define FILENAME "test2.tng" +#define FILENAME "test2.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test20.h b/src/tests/compression/test20.h index 7df8f09..4a45135 100644 --- a/src/tests/compression/test20.h +++ b/src/tests/compression/test20.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding of velocities. Stopbit one-to-one. Cubic cell." -#define FILENAME "test20.tng" +#define FILENAME "test20.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test21.h b/src/tests/compression/test21.h index 2ea2353..773c1da 100644 --- a/src/tests/compression/test21.h +++ b/src/tests/compression/test21.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding of velocities. Triplet inter. Cubic cell." -#define FILENAME "test21.tng" +#define FILENAME "test21.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test22.h b/src/tests/compression/test22.h index 8b16428..1d8cfa9 100644 --- a/src/tests/compression/test22.h +++ b/src/tests/compression/test22.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding of velocities. Triplet one-to-one. Cubic cell." -#define FILENAME "test22.tng" +#define FILENAME "test22.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test23.h b/src/tests/compression/test23.h index 85025d6..950f7ee 100644 --- a/src/tests/compression/test23.h +++ b/src/tests/compression/test23.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding of velocities. Stopbit interframe. Cubic cell." -#define FILENAME "test23.tng" +#define FILENAME "test23.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test24.h b/src/tests/compression/test24.h index dae943c..4b20897 100644 --- a/src/tests/compression/test24.h +++ b/src/tests/compression/test24.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding of velocities. BWLZH interframe. Cubic cell." -#define FILENAME "test24.tng" +#define FILENAME "test24.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 25 diff --git a/src/tests/compression/test25.h b/src/tests/compression/test25.h index 6145cb9..37d777a 100644 --- a/src/tests/compression/test25.h +++ b/src/tests/compression/test25.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding of velocities. BWLZH one-to-one. Cubic cell." -#define FILENAME "test25.tng" +#define FILENAME "test25.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 25 diff --git a/src/tests/compression/test26.h b/src/tests/compression/test26.h index 74523ad..2c3b304 100644 --- a/src/tests/compression/test26.h +++ b/src/tests/compression/test26.h @@ -1,5 +1,5 @@ #define TESTNAME "XTC2 algorithm. Orthorhombic cell." -#define FILENAME "test26.tng" +#define FILENAME "test26.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test27.h b/src/tests/compression/test27.h index 30aea07..af7c9ff 100644 --- a/src/tests/compression/test27.h +++ b/src/tests/compression/test27.h @@ -1,5 +1,5 @@ #define TESTNAME "XTC3 algorithm. Orthorhombic cell." -#define FILENAME "test27.tng" +#define FILENAME "test27.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test28.h b/src/tests/compression/test28.h index 995b81c..99a70fc 100644 --- a/src/tests/compression/test28.h +++ b/src/tests/compression/test28.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. Autoselect algorithm. Repetitive molecule. Cubic cell." -#define FILENAME "test28.tng" +#define FILENAME "test28.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test29.h b/src/tests/compression/test29.h index f48f909..be6a8bf 100644 --- a/src/tests/compression/test29.h +++ b/src/tests/compression/test29.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Autoselect algorithm. Repetitive molecule. Cubic cell." -#define FILENAME "test29.tng" +#define FILENAME "test29.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test3.h b/src/tests/compression/test3.h index c4bbebd..768a208 100644 --- a/src/tests/compression/test3.h +++ b/src/tests/compression/test3.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. Triplet one-to-one algorithm. Cubic cell." -#define FILENAME "test3.tng" +#define FILENAME "test3.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test30.h b/src/tests/compression/test30.h index 2ea607b..b719c7b 100644 --- a/src/tests/compression/test30.h +++ b/src/tests/compression/test30.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. Intra frame triple algorithm. Large system. Cubic cell." -#define FILENAME "test30.tng" +#define FILENAME "test30.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 1 diff --git a/src/tests/compression/test31.h b/src/tests/compression/test31.h index d5d86d4..c0763e8 100644 --- a/src/tests/compression/test31.h +++ b/src/tests/compression/test31.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. XTC2 algorithm. Large system. Cubic cell." -#define FILENAME "test31.tng" +#define FILENAME "test31.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 1 diff --git a/src/tests/compression/test32.h b/src/tests/compression/test32.h index 7b66438..5f2e2f9 100644 --- a/src/tests/compression/test32.h +++ b/src/tests/compression/test32.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. XTC3 algorithm. Large system. Cubic cell." -#define FILENAME "test32.tng" +#define FILENAME "test32.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 1 diff --git a/src/tests/compression/test33.h b/src/tests/compression/test33.h index 9463eeb..3d08a65 100644 --- a/src/tests/compression/test33.h +++ b/src/tests/compression/test33.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. Intra frame BWLZH algorithm. Large system. Cubic cell." -#define FILENAME "test33.tng" +#define FILENAME "test33.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 1 diff --git a/src/tests/compression/test34.h b/src/tests/compression/test34.h index 14fe88f..4242c18 100644 --- a/src/tests/compression/test34.h +++ b/src/tests/compression/test34.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Stop bits algorithm. Large system. Cubic cell." -#define FILENAME "test34.tng" +#define FILENAME "test34.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 2 diff --git a/src/tests/compression/test35.h b/src/tests/compression/test35.h index 44af4c4..8f742b7 100644 --- a/src/tests/compression/test35.h +++ b/src/tests/compression/test35.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Inter frame triple algorithm. Large system. Cubic cell." -#define FILENAME "test35.tng" +#define FILENAME "test35.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 2 diff --git a/src/tests/compression/test36.h b/src/tests/compression/test36.h index 56f5dcd..fba6feb 100644 --- a/src/tests/compression/test36.h +++ b/src/tests/compression/test36.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Intra frame triple algorithm. Large system. Cubic cell." -#define FILENAME "test36.tng" +#define FILENAME "test36.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 2 diff --git a/src/tests/compression/test37.h b/src/tests/compression/test37.h index 68b4872..d2722bf 100644 --- a/src/tests/compression/test37.h +++ b/src/tests/compression/test37.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. XTC2 algorithm. Large system. Cubic cell." -#define FILENAME "test37.tng" +#define FILENAME "test37.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 2 diff --git a/src/tests/compression/test38.h b/src/tests/compression/test38.h index 7e43348..26a6740 100644 --- a/src/tests/compression/test38.h +++ b/src/tests/compression/test38.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. XTC3 algorithm. Large system. Cubic cell." -#define FILENAME "test38.tng" +#define FILENAME "test38.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 2 diff --git a/src/tests/compression/test39.h b/src/tests/compression/test39.h index bb3ecc0..db09a18 100644 --- a/src/tests/compression/test39.h +++ b/src/tests/compression/test39.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Intra frame BWLZH algorithm. Large system. Cubic cell." -#define FILENAME "test39.tng" +#define FILENAME "test39.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 2 diff --git a/src/tests/compression/test4.h b/src/tests/compression/test4.h index 63ec9da..dfda25d 100644 --- a/src/tests/compression/test4.h +++ b/src/tests/compression/test4.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. BWLZH one-to-one algorithm. Cubic cell." -#define FILENAME "test4.tng" +#define FILENAME "test4.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test40.h b/src/tests/compression/test40.h index 5eb9c0d..c7511e5 100644 --- a/src/tests/compression/test40.h +++ b/src/tests/compression/test40.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Inter frame BWLZH algorithm. Large system. Cubic cell." -#define FILENAME "test40.tng" +#define FILENAME "test40.tng_compress" #define ALGOTEST #define NATOMS 5000000 #define CHUNKY 2 diff --git a/src/tests/compression/test41.h b/src/tests/compression/test41.h index f673944..dab390c 100644 --- a/src/tests/compression/test41.h +++ b/src/tests/compression/test41.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. Intra frame triple algorithm. High accuracy. Cubic cell." -#define FILENAME "test41.tng" +#define FILENAME "test41.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 1 diff --git a/src/tests/compression/test42.h b/src/tests/compression/test42.h index b40f963..4452924 100644 --- a/src/tests/compression/test42.h +++ b/src/tests/compression/test42.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. XTC2 algorithm. High accuracy. Cubic cell." -#define FILENAME "test42.tng" +#define FILENAME "test42.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 1 diff --git a/src/tests/compression/test43.h b/src/tests/compression/test43.h index 38a59db..915d58e 100644 --- a/src/tests/compression/test43.h +++ b/src/tests/compression/test43.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. XTC3 algorithm. High accuracy. Cubic cell." -#define FILENAME "test43.tng" +#define FILENAME "test43.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 1 diff --git a/src/tests/compression/test44.h b/src/tests/compression/test44.h index 0bab871..f749cce 100644 --- a/src/tests/compression/test44.h +++ b/src/tests/compression/test44.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. Intra frame BWLZH algorithm. High accuracy. Cubic cell." -#define FILENAME "test44.tng" +#define FILENAME "test44.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 1 diff --git a/src/tests/compression/test45.h b/src/tests/compression/test45.h index 095efed..e558083 100644 --- a/src/tests/compression/test45.h +++ b/src/tests/compression/test45.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Stop bits algorithm. High accuracy. Cubic cell." -#define FILENAME "test45.tng" +#define FILENAME "test45.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test46.h b/src/tests/compression/test46.h index dc0b8bb..dde45ab 100644 --- a/src/tests/compression/test46.h +++ b/src/tests/compression/test46.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Inter frame triple algorithm. High accuracy. Cubic cell." -#define FILENAME "test46.tng" +#define FILENAME "test46.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test47.h b/src/tests/compression/test47.h index 5a5182d..a668946 100644 --- a/src/tests/compression/test47.h +++ b/src/tests/compression/test47.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Intra frame triple algorithm. High accuracy. Cubic cell." -#define FILENAME "test47.tng" +#define FILENAME "test47.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test48.h b/src/tests/compression/test48.h index 1562779..3b2be95 100644 --- a/src/tests/compression/test48.h +++ b/src/tests/compression/test48.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. XTC2 algorithm. High accuracy. Cubic cell." -#define FILENAME "test48.tng" +#define FILENAME "test48.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test49.h b/src/tests/compression/test49.h index dcad4ec..6c618a0 100644 --- a/src/tests/compression/test49.h +++ b/src/tests/compression/test49.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. XTC3 algorithm. High accuracy. Cubic cell." -#define FILENAME "test49.tng" +#define FILENAME "test49.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test5.h b/src/tests/compression/test5.h index a933044..4c6a638 100644 --- a/src/tests/compression/test5.h +++ b/src/tests/compression/test5.h @@ -1,5 +1,5 @@ #define TESTNAME "Initial coding. XTC3 algorithm. Cubic cell." -#define FILENAME "test5.tng" +#define FILENAME "test5.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 1 diff --git a/src/tests/compression/test50.h b/src/tests/compression/test50.h index a00e209..130f1b9 100644 --- a/src/tests/compression/test50.h +++ b/src/tests/compression/test50.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Intra frame BWLZH algorithm. High accuracy. Cubic cell." -#define FILENAME "test50.tng" +#define FILENAME "test50.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test51.h b/src/tests/compression/test51.h index 4641b61..c3a57bf 100644 --- a/src/tests/compression/test51.h +++ b/src/tests/compression/test51.h @@ -1,5 +1,5 @@ #define TESTNAME "Position coding. Inter frame BWLZH algorithm. High accuracy. Cubic cell." -#define FILENAME "test51.tng" +#define FILENAME "test51.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test52.h b/src/tests/compression/test52.h index 2f49a8b..97f37c7 100644 --- a/src/tests/compression/test52.h +++ b/src/tests/compression/test52.h @@ -1,5 +1,5 @@ #define TESTNAME "Velocity coding. Stop bits algorithm. High accuracy. Cubic cell." -#define FILENAME "test52.tng" +#define FILENAME "test52.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test53.h b/src/tests/compression/test53.h index 679b680..583e0b2 100644 --- a/src/tests/compression/test53.h +++ b/src/tests/compression/test53.h @@ -1,5 +1,5 @@ #define TESTNAME "Velocity coding. Triple algorithm. High accuracy. Cubic cell." -#define FILENAME "test53.tng" +#define FILENAME "test53.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test54.h b/src/tests/compression/test54.h index c2c2869..50b051f 100644 --- a/src/tests/compression/test54.h +++ b/src/tests/compression/test54.h @@ -1,5 +1,5 @@ #define TESTNAME "Velocity coding. Interframe triple algorithm. High accuracy. Cubic cell." -#define FILENAME "test54.tng" +#define FILENAME "test54.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test55.h b/src/tests/compression/test55.h index a094d97..f8c98f9 100644 --- a/src/tests/compression/test55.h +++ b/src/tests/compression/test55.h @@ -1,5 +1,5 @@ #define TESTNAME "Velocity coding. Interframe stop-bits algorithm. High accuracy. Cubic cell." -#define FILENAME "test55.tng" +#define FILENAME "test55.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test56.h b/src/tests/compression/test56.h index 6655ad0..7fb9b23 100644 --- a/src/tests/compression/test56.h +++ b/src/tests/compression/test56.h @@ -1,5 +1,5 @@ #define TESTNAME "Velocity coding. Intraframe BWLZH algorithm. High accuracy. Cubic cell." -#define FILENAME "test56.tng" +#define FILENAME "test56.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test57.h b/src/tests/compression/test57.h index 2788e98..5c626d8 100644 --- a/src/tests/compression/test57.h +++ b/src/tests/compression/test57.h @@ -1,5 +1,5 @@ #define TESTNAME "Velocity coding. Interframe BWLZH algorithm. High accuracy. Cubic cell." -#define FILENAME "test57.tng" +#define FILENAME "test57.tng_compress" #define ALGOTEST #define NATOMS 100000 #define CHUNKY 10 diff --git a/src/tests/compression/test58.h b/src/tests/compression/test58.h new file mode 100644 index 0000000..18be47f --- /dev/null +++ b/src/tests/compression/test58.h @@ -0,0 +1,26 @@ +#define TESTNAME "Coding. Test float." +#define FILENAME "test58.tng_compress" +#define ALGOTEST +#define NATOMS 1000 +#define CHUNKY 100 +#define SCALE 0.1 +#define PRECISION 0.01 +#define WRITEVEL 1 +#define VELPRECISION 0.1 +#define INITIALCODING 5 +#define INITIALCODINGPARAMETER 0 +#define CODING 5 +#define CODINGPARAMETER 0 +#define INITIALVELCODING 3 +#define INITIALVELCODINGPARAMETER -1 +#define VELCODING 3 +#define VELCODINGPARAMETER -1 +#define INTMIN1 0 +#define INTMIN2 0 +#define INTMIN3 0 +#define INTMAX1 10000 +#define INTMAX2 10000 +#define INTMAX3 10000 +#define NFRAMES 1000 +#define TEST_FLOAT +#define EXPECTED_FILESIZE 7237102. diff --git a/src/tests/compression/test59.h b/src/tests/compression/test59.h new file mode 100644 index 0000000..0b6079e --- /dev/null +++ b/src/tests/compression/test59.h @@ -0,0 +1,28 @@ +#define TESTNAME "Coding. Test write float, read double." +#define FILENAME "test59.tng_compress" +#define ALGOTEST +#define NATOMS 1000 +#define CHUNKY 100 +#define SCALE 0.1 +#define PRECISION 0.01 +#define WRITEVEL 1 +#define VELPRECISION 0.1 +#define INITIALCODING 5 +#define INITIALCODINGPARAMETER 0 +#define CODING 5 +#define CODINGPARAMETER 0 +#define INITIALVELCODING 3 +#define INITIALVELCODINGPARAMETER -1 +#define VELCODING 3 +#define VELCODINGPARAMETER -1 +#define INTMIN1 0 +#define INTMIN2 0 +#define INTMIN3 0 +#define INTMAX1 10000 +#define INTMAX2 10000 +#define INTMAX3 10000 +#define NFRAMES 1000 +#ifdef GEN +#define TEST_FLOAT +#endif +#define EXPECTED_FILESIZE 7237102. diff --git a/src/tests/compression/test6.h b/src/tests/compression/test6.h index cd3cfee..ecbc443 100644 --- a/src/tests/compression/test6.h +++ b/src/tests/compression/test6.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. XTC2 algorithm. Cubic cell." -#define FILENAME "test6.tng" +#define FILENAME "test6.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test7.h b/src/tests/compression/test7.h index 90a2657..d0e3532 100644 --- a/src/tests/compression/test7.h +++ b/src/tests/compression/test7.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. Stopbit interframe algorithm. Cubic cell." -#define FILENAME "test7.tng" +#define FILENAME "test7.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test8.h b/src/tests/compression/test8.h index 5a21053..2ce103c 100644 --- a/src/tests/compression/test8.h +++ b/src/tests/compression/test8.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. Stopbit interframe algorithm with intraframe compression as initial. Cubic cell." -#define FILENAME "test8.tng" +#define FILENAME "test8.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test9.h b/src/tests/compression/test9.h index 1247beb..f0672e2 100644 --- a/src/tests/compression/test9.h +++ b/src/tests/compression/test9.h @@ -1,5 +1,5 @@ #define TESTNAME "Coding. Triple interframe algorithm. Cubic cell." -#define FILENAME "test9.tng" +#define FILENAME "test9.tng_compress" #define ALGOTEST #define NATOMS 1000 #define CHUNKY 100 diff --git a/src/tests/compression/test_tng_compress_read.bat b/src/tests/compression/test_tng_compress_read.bat new file mode 100644 index 0000000..01873f8 --- /dev/null +++ b/src/tests/compression/test_tng_compress_read.bat @@ -0,0 +1,13 @@ +@echo off +setlocal enableextensions enabledelayedexpansion +SET /A I=0 +:start +SET /A I+=1 +test_tng_compress_read%I% +IF "%I%" == "57" ( + GOTO end +) ELSE ( + GOTO start +) +:end +endlocal diff --git a/src/tests/compression/test_tng_compress_read.sh b/src/tests/compression/test_tng_compress_read.sh new file mode 100755 index 0000000..76f9193 --- /dev/null +++ b/src/tests/compression/test_tng_compress_read.sh @@ -0,0 +1,5 @@ +#!/bin/sh +numtests=57 +for x in $(seq 1 $numtests); do + ./test_tng_compress_read$x +done
\ No newline at end of file diff --git a/src/tests/compression/test_tng_compress_write.bat b/src/tests/compression/test_tng_compress_write.bat new file mode 100644 index 0000000..ba1d93e --- /dev/null +++ b/src/tests/compression/test_tng_compress_write.bat @@ -0,0 +1,13 @@ +@echo off +setlocal enableextensions enabledelayedexpansion +SET /A I=0 +:start +SET /A I+=1 +test_tng_compress_gen%I% +IF "%I%" == "57" ( + GOTO end +) ELSE ( + GOTO start +) +:end +endlocal diff --git a/src/tests/compression/test_tng_compress_write.sh b/src/tests/compression/test_tng_compress_write.sh new file mode 100755 index 0000000..8f0ef01 --- /dev/null +++ b/src/tests/compression/test_tng_compress_write.sh @@ -0,0 +1,5 @@ +#!/bin/sh +numtests=57 +for x in $(seq 1 $numtests); do + ./test_tng_compress_gen$x +done
\ No newline at end of file diff --git a/src/tests/compression/testsuite.c b/src/tests/compression/testsuite.c index 1c5b613..cc38cb6 100644 --- a/src/tests/compression/testsuite.c +++ b/src/tests/compression/testsuite.c @@ -9,9 +9,19 @@ #include <string.h> #include <math.h> #include <tng_compress.h> -#include <warnmalloc.h> +#include "tng_compress_testing.h" #include TESTPARAM +#ifdef TEST_FLOAT +#define REAL float +#else +#define REAL double +#endif + +#ifndef TNG_COMPRESS_FILES_DIR +#define TNG_COMPRESS_FILES_DIR "" +#endif + #define FUDGE 1.1 /* 10% off target precision is acceptable */ static void keepinbox(int *val) @@ -201,39 +211,39 @@ static void genivelbox(int *intvelbox, int iframe) #define GENVELPRECISION VELPRECISION #endif -static void realbox(int *intbox, double *realbox, int stride) +static void realbox(int *intbox, REAL *realbox, int stride) { int i,j; for (i=0; i<NATOMS; i++) { for (j=0; j<3; j++) - realbox[i*stride+j]=(double)(intbox[i*3+j]*GENPRECISION*SCALE); + realbox[i*stride+j]=(REAL)(intbox[i*3+j]*GENPRECISION*SCALE); for (j=3; j<stride; j++) realbox[i*stride+j]=0.; } } -static void realvelbox(int *intbox, double *realbox, int stride) +static void realvelbox(int *intbox, REAL *realbox, int stride) { int i,j; for (i=0; i<NATOMS; i++) { for (j=0; j<3; j++) - realbox[i*stride+j]=(double)(intbox[i*3+j]*GENVELPRECISION*SCALE); + realbox[i*stride+j]=(REAL)(intbox[i*3+j]*GENVELPRECISION*SCALE); for (j=3; j<stride; j++) realbox[i*stride+j]=0.; } } -static int equalarr(double *arr1, double *arr2, double prec, int len, int itemlen, int stride1, int stride2) +static int equalarr(REAL *arr1, REAL *arr2, REAL prec, int len, int itemlen, int stride1, int stride2) { - double maxdiff=0.; + REAL maxdiff=0.; int i,j; for (i=0; i<len; i++) { for (j=0; j<itemlen; j++) if (fabs(arr1[i*stride1+j]-arr2[i*stride2+j])>maxdiff) - maxdiff=(double)fabs(arr1[i*stride1+j]-arr2[i*stride2+j]); + maxdiff=(REAL)fabs(arr1[i*stride1+j]-arr2[i*stride2+j]); } #if 0 for (i=0; i<len; i++) @@ -258,8 +268,8 @@ struct tng_file FILE *f; int natoms; int chunky; - double precision; - double velprecision; + REAL precision; + REAL velprecision; int initial_coding; int initial_coding_parameter; int coding; @@ -272,8 +282,8 @@ struct tng_file int nframes; int nframes_delivered; int writevel; - double *pos; - double *vel; + REAL *pos; + REAL *vel; }; static size_t fwrite_int_le(int *x,FILE *f) @@ -302,9 +312,9 @@ static size_t fread_int_le(int *x,FILE *f) static struct tng_file *open_tng_file_write(char *filename, int natoms,int chunky, - double precision, + REAL precision, int writevel, - double velprecision, + REAL velprecision, int initial_coding, int initial_coding_parameter, int coding, @@ -351,11 +361,19 @@ static void flush_tng_frames(struct tng_file *tng_file) algo[1]=tng_file->initial_coding_parameter; algo[2]=tng_file->coding; algo[3]=tng_file->coding_parameter; +#ifdef TEST_FLOAT + buf=tng_compress_pos_float(tng_file->pos, + tng_file->natoms, + tng_file->nframes, + tng_file->precision, + tng_file->speed,algo,&nitems); +#else buf=tng_compress_pos(tng_file->pos, tng_file->natoms, tng_file->nframes, tng_file->precision, tng_file->speed,algo,&nitems); +#endif tng_file->initial_coding=algo[0]; tng_file->initial_coding_parameter=algo[1]; tng_file->coding=algo[2]; @@ -369,11 +387,19 @@ static void flush_tng_frames(struct tng_file *tng_file) algo[1]=tng_file->initial_velcoding_parameter; algo[2]=tng_file->velcoding; algo[3]=tng_file->velcoding_parameter; +#ifdef TEST_FLOAT + buf=tng_compress_vel_float(tng_file->vel, + tng_file->natoms, + tng_file->nframes, + tng_file->velprecision, + tng_file->speed,algo,&nitems); +#else buf=tng_compress_vel(tng_file->vel, tng_file->natoms, tng_file->nframes, tng_file->velprecision, tng_file->speed,algo,&nitems); +#endif tng_file->initial_velcoding=algo[0]; tng_file->initial_velcoding_parameter=algo[1]; tng_file->velcoding=algo[2]; @@ -386,7 +412,7 @@ static void flush_tng_frames(struct tng_file *tng_file) } static void write_tng_file(struct tng_file *tng_file, - double *pos,double *vel) + REAL *pos,REAL *vel) { memcpy(tng_file->pos+tng_file->nframes*tng_file->natoms*3,pos,tng_file->natoms*3*sizeof *tng_file->pos); if (tng_file->writevel) @@ -415,13 +441,19 @@ static struct tng_file *open_tng_file_read(char *filename, int writevel) tng_file->nframes=0; tng_file->nframes_delivered=0; tng_file->writevel=writevel; - fread_int_le(&tng_file->natoms,tng_file->f); + if (tng_file->f) + fread_int_le(&tng_file->natoms,tng_file->f); + else + { + free(tng_file); + tng_file=NULL; + } return tng_file; } static int read_tng_file(struct tng_file *tng_file, - double *pos, - double *vel) + REAL *pos, + REAL *vel) { if (tng_file->nframes==tng_file->nframes_delivered) { @@ -451,7 +483,11 @@ static int read_tng_file(struct tng_file *tng_file, printf("ivel=%d natoms=%d nframes=%d precision=%g initial pos=%s pos=%s\n",ivel,natoms,nframes,precision,initial_coding,coding); } #endif +#ifdef TEST_FLOAT + tng_compress_uncompress_float(buf,tng_file->pos); +#else tng_compress_uncompress(buf,tng_file->pos); +#endif free(buf); if (tng_file->writevel) { @@ -472,7 +508,11 @@ static int read_tng_file(struct tng_file *tng_file, printf("ivel=%d natoms=%d nframes=%d precision=%g initial vel=%s vel=%s\n",ivel,natoms,nframes,precision,initial_coding,coding); } #endif +#ifdef TEST_FLOAT + tng_compress_uncompress_float(buf,tng_file->vel); +#else tng_compress_uncompress(buf,tng_file->vel); +#endif free(buf); } tng_file->nframes_delivered=0; @@ -519,34 +559,34 @@ static void close_tng_file_read(struct tng_file *tng_file) static int algotest() { int i; - int *intbox=warnmalloc(NATOMS*3*sizeof *intbox); - int *intvelbox=warnmalloc(NATOMS*3*sizeof *intvelbox); - double *box1=warnmalloc(NATOMS*STRIDE1*sizeof *box1); - double *velbox1=warnmalloc(NATOMS*STRIDE1*sizeof *velbox1); - double time1, lambda1; - double H1[9]; + int *intbox=malloc(NATOMS*3*sizeof *intbox); + int *intvelbox=malloc(NATOMS*3*sizeof *intvelbox); + REAL *box1=malloc(NATOMS*STRIDE1*sizeof *box1); + REAL *velbox1=malloc(NATOMS*STRIDE1*sizeof *velbox1); + REAL time1, lambda1; + REAL H1[9]; int startframe=0; int endframe=NFRAMES; #ifdef GEN FILE *file; - double filesize; + REAL filesize; #else int i2; int readreturn; - double H2[9]; - double time2, lambda2; - double *box2=warnmalloc(NATOMS*STRIDE2*sizeof *box2); - double *velbox2=warnmalloc(NATOMS*STRIDE2*sizeof *velbox2); + REAL H2[9]; + REAL time2, lambda2; + REAL *box2=malloc(NATOMS*STRIDE2*sizeof *box2); + REAL *velbox2=malloc(NATOMS*STRIDE2*sizeof *velbox2); #endif #ifdef GEN - void *dumpfile=open_tng_file_write(FILENAME,NATOMS,CHUNKY, + void *dumpfile=open_tng_file_write(TNG_COMPRESS_FILES_DIR FILENAME,NATOMS,CHUNKY, PRECISION,WRITEVEL,VELPRECISION, INITIALCODING, INITIALCODINGPARAMETER,CODING,CODINGPARAMETER, INITIALVELCODING,INITIALVELCODINGPARAMETER, VELCODING,VELCODINGPARAMETER,SPEED); #else - void *dumpfile=open_tng_file_read(FILENAME,WRITEVEL); + void *dumpfile=open_tng_file_read(TNG_COMPRESS_FILES_DIR FILENAME,WRITEVEL); #endif if (!dumpfile) return 1; @@ -563,8 +603,8 @@ static int algotest() genivelbox(intvelbox,i); realvelbox(intvelbox,velbox1,STRIDE1); #endif - time1=(double)i; - lambda1=(double)(i+100); + time1=(REAL)i; + lambda1=(REAL)(i+100); #ifdef GEN write_tng_file(dumpfile,box1,velbox1); #else @@ -574,10 +614,10 @@ static int algotest() #endif #ifndef GEN /* Check for equality of boxes. */ - if (!equalarr(box1,box2,(double)PRECISION,NATOMS,3,STRIDE1,STRIDE2)) + if (!equalarr(box1,box2,(REAL)PRECISION,NATOMS,3,STRIDE1,STRIDE2)) return 4; #if WRITEVEL - if (!equalarr(velbox1,velbox2,(double)VELPRECISION,NATOMS,3,STRIDE1,STRIDE2)) + if (!equalarr(velbox1,velbox2,(REAL)VELPRECISION,NATOMS,3,STRIDE1,STRIDE2)) return 5; #endif #endif @@ -589,9 +629,9 @@ static int algotest() #endif #ifdef GEN /* Check against expected filesize for this test. */ - if (!(file=fopen(FILENAME,"rb"))) + if (!(file=fopen(TNG_COMPRESS_FILES_DIR FILENAME,"rb"))) { - fprintf(stderr,"ERROR: Cannot open file "FILENAME"\n"); + fprintf(stderr,"ERROR: Cannot open file "TNG_COMPRESS_FILES_DIR FILENAME"\n"); exit(EXIT_FAILURE); } filesize=0; diff --git a/src/tests/compression/testsuite.sh b/src/tests/compression/testsuite.sh deleted file mode 100755 index 6aecff5..0000000 --- a/src/tests/compression/testsuite.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -do_write_test="Yes" -if [ -n "$1" ]; then - do_write_test="" -fi -STARTTEST=1 -ENDTEST=57 -#CFLAGS="-Wall -O2 -I../../../include/compress" -CFLAGS="-O2 -I../../../include/compression" -LIBS="-L../../../build/lib -ltng_compress -lm" -LD_LIBRARY_PATH="../../../build/lib:$LD_LIBRARY_PATH" -export LD_LIBRARY_PATH -#CFLAGS="-O0 -Wall -g" -#LIBS="-lm -lefence" -CC="gcc" -# 32 bit -#CC="gcc -m32" -for testnum in $(seq $STARTTEST $ENDTEST); do - testname=$(grep "TESTNAME" test$testnum.h|sed 's/#define TESTNAME//') - sed "s/TESTPARAM/\"test$testnum.h\"/" <testsuite.c >test$testnum.c - if [ -n "$do_write_test" ]; then - echo Write test $testnum: $testname - $CC -DGEN $CFLAGS -o gen$testnum test$testnum.c -ltng_compress $LIBS - ./gen$testnum - rm -f gen$testnum - fi - echo Read test $testnum: $testname - $CC $CFLAGS -o read$testnum test$testnum.c -ltng_compress $LIBS - ./read$testnum - rm -f read$testnum - rm -f test$testnum.c -done - - - |