Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2019-10-07 11:21:59 +0300
committertamasmeszaros <meszaros.q@gmail.com>2019-10-07 11:21:59 +0300
commitf1388fffba04cbc80ce4977b05c25ffdba932a79 (patch)
tree42b3c11cdf8660bf062b8eec10b826e100416baf /tests
parent5bf3d5aabf2ec5485069d24d4f67b09aee833027 (diff)
Fix test outputs on buildbot. Also fix pairhash test.
Diffstat (limited to 'tests')
-rw-r--r--tests/libnest2d/CMakeLists.txt3
-rw-r--r--tests/sla_print/CMakeLists.txt5
-rw-r--r--tests/sla_print/sla_print_tests.cpp11
-rw-r--r--tests/sla_print/tests_main.cpp2
-rw-r--r--tests/timeutils/CMakeLists.txt3
5 files changed, 15 insertions, 9 deletions
diff --git a/tests/libnest2d/CMakeLists.txt b/tests/libnest2d/CMakeLists.txt
index ac7debf93..ee38280b5 100644
--- a/tests/libnest2d/CMakeLists.txt
+++ b/tests/libnest2d/CMakeLists.txt
@@ -2,4 +2,5 @@ get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp printer_parts.cpp printer_parts.hpp)
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES})
-catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
+# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
+add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")
diff --git a/tests/sla_print/CMakeLists.txt b/tests/sla_print/CMakeLists.txt
index 8df8abc8e..687096ee4 100644
--- a/tests/sla_print/CMakeLists.txt
+++ b/tests/sla_print/CMakeLists.txt
@@ -1,5 +1,6 @@
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
-add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests.cpp tests_main.cpp)
+add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests.cpp)
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES})
-catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
+#catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
+add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")
diff --git a/tests/sla_print/sla_print_tests.cpp b/tests/sla_print/sla_print_tests.cpp
index 69920eaa7..74b1ed8b1 100644
--- a/tests/sla_print/sla_print_tests.cpp
+++ b/tests/sla_print/sla_print_tests.cpp
@@ -1,3 +1,4 @@
+#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <unordered_set>
@@ -358,10 +359,13 @@ template <class I, class II> void test_pairhash()
const I Ibits = int(sizeof(I) * CHAR_BIT);
const II IIbits = int(sizeof(II) * CHAR_BIT);
- const int bits = IIbits / 2 < Ibits ? Ibits / 2 : Ibits;
-
+
+ int bits = IIbits / 2 < Ibits ? Ibits / 2 : Ibits;
+ if (std::is_signed<I>::value) bits -= 1;
+ const I Imin = std::is_signed<I>::value ? -I(std::pow(2., bits)) : 0;
const I Imax = I(std::pow(2., bits) - 1);
- std::uniform_int_distribution<I> dis(0, Imax);
+
+ std::uniform_int_distribution<I> dis(Imin, Imax);
for (size_t i = 0; i < nums;) {
I a = dis(gen);
@@ -395,6 +399,7 @@ template <class I, class II> void test_pairhash()
}
TEST_CASE("Pillar pairhash should be unique", "[SLASupportGeneration]") {
+ test_pairhash<int, int>();
test_pairhash<int, long>();
test_pairhash<unsigned, unsigned>();
test_pairhash<unsigned, unsigned long>();
diff --git a/tests/sla_print/tests_main.cpp b/tests/sla_print/tests_main.cpp
deleted file mode 100644
index 4ed06df1f..000000000
--- a/tests/sla_print/tests_main.cpp
+++ /dev/null
@@ -1,2 +0,0 @@
-#define CATCH_CONFIG_MAIN
-#include <catch2/catch.hpp>
diff --git a/tests/timeutils/CMakeLists.txt b/tests/timeutils/CMakeLists.txt
index 95f5e3762..c4b7c2029 100644
--- a/tests/timeutils/CMakeLists.txt
+++ b/tests/timeutils/CMakeLists.txt
@@ -2,4 +2,5 @@ get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp)
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES})
-catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
+# catch_discover_tests(${_TEST_NAME}_tests TEST_PREFIX "${_TEST_NAME}: ")
+add_test(${_TEST_NAME}_tests ${_TEST_NAME}_tests "--durations yes")