diff options
Diffstat (limited to 'src/test-unicode.cpp')
-rw-r--r-- | src/test-unicode.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/test-unicode.cpp b/src/test-unicode.cpp index e7dfa6f..2675989 100644 --- a/src/test-unicode.cpp +++ b/src/test-unicode.cpp @@ -5,7 +5,11 @@ #include <boost/test/data/dataset.hpp> #include <boost/test/data/monomorphic.hpp> #include <boost/test/data/test_case.hpp> +#include <boost/version.hpp> +#if BOOST_VERSION > 106700 +// CPU Timer in Debian 10 boost is broken, so leave it to std::chrono wall clock #include <boost/timer/timer.hpp> +#endif #include <array> #include <chrono> @@ -99,6 +103,10 @@ namespace std { return os; } +} // namespace std + +namespace { + // utility wrapper to adapt locale-bound facets for wstring/wbuffer convert template<class Facet> struct deletable_facet : Facet @@ -174,7 +182,8 @@ namespace std { { return conv32.from_bytes(conv32.to_bytes(s)); } -} + +} // namespace // check assumptions about environment BOOST_AUTO_TEST_CASE(string_u8string) @@ -530,16 +539,23 @@ public: ~CPUTimer() { +#if BOOST_VERSION > 106700 auto elapsed_cpu{mCPUTimer.elapsed()}; +#endif std::cout << mName << ": " << std::chrono::duration<double>(std::chrono::steady_clock::now() - mWallTime0).count() << - "s (" << (double(elapsed_cpu.user + elapsed_cpu.system) / 1000000000) << - "s CPU)" << std::endl; + "s" << +#if BOOST_VERSION > 106700 + " (" << (double(elapsed_cpu.user + elapsed_cpu.system) / 1000000000) << "s CPU)" << +#endif + std::endl; } private: std::string mName; std::chrono::time_point<std::chrono::steady_clock> mWallTime0; +#if BOOST_VERSION > 106700 boost::timer::cpu_timer mCPUTimer; +#endif }; template<typename From, typename ToTypesCollectionType, size_t index = 0> |