also test threaded things with cmake

This commit is contained in:
Hans Dembinski 2019-04-16 23:41:03 +02:00
parent 5a6a78e5b6
commit 07c3638423
2 changed files with 6 additions and 2 deletions

View File

@ -31,6 +31,12 @@ boost_test(TYPE run SOURCES storage_adaptor_test.cpp LIBRARIES Boost::histogram
boost_test(TYPE run SOURCES unlimited_storage_test.cpp LIBRARIES Boost::histogram Boost::core)
boost_test(TYPE run SOURCES utility_test.cpp LIBRARIES Boost::histogram Boost::core)
find_package(Threads)
if (Threads_FOUND)
boost_test(TYPE run SOURCES histogram_threaded_test.cpp LIBRARIES Boost::histogram Boost::core Threads::Threads)
boost_test(TYPE run SOURCES storage_adaptor_threaded_test.cpp LIBRARIES Boost::histogram Boost::core Threads::Threads)
endif()
# boost_test(TYPE run SOURCES deduction_guides_test.cpp LIBRARIES Boost::histogram Boost::core)
# boost_test(TYPE run SOURCES unlimited_storage_serialization_test.cpp LIBRARIES Boost::histogram Boost::core Boost::serialization)

View File

@ -6,7 +6,6 @@
#include <boost/core/lightweight_test.hpp>
#include <boost/histogram.hpp>
#include <chrono>
#include <iostream>
#include <random>
#include <thread>
@ -22,7 +21,6 @@ void fill_test(const A1& a1, const A2& a2, const X& x, const Y& y) {
for (unsigned i = 0; i != n_fill; ++i) h1(x[i], y[i]);
auto h2 = make_s(Tag{}, dense_storage<accumulators::thread_safe<int>>(), a1, a2);
auto run = [&h2, &x, &y](int k) {
std::this_thread::sleep_for(std::chrono::nanoseconds(10));
constexpr auto shift = n_fill / 4;
auto xit = x.cbegin() + k * shift;
auto yit = y.cbegin() + k * shift;