From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../opentracing-cpp/test/util_test.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/jaegertracing/opentracing-cpp/test/util_test.cpp (limited to 'src/jaegertracing/opentracing-cpp/test/util_test.cpp') diff --git a/src/jaegertracing/opentracing-cpp/test/util_test.cpp b/src/jaegertracing/opentracing-cpp/test/util_test.cpp new file mode 100644 index 000000000..9c1e30d02 --- /dev/null +++ b/src/jaegertracing/opentracing-cpp/test/util_test.cpp @@ -0,0 +1,26 @@ +#include +#include +#include // Work around to https://stackoverflow.com/a/30084734. +using namespace opentracing; + +#define CATCH_CONFIG_MAIN +#include + +TEST_CASE("convert_time_point") { + SECTION("We can convert between time points of different clocks") { + // Check that converting from a system_clock time_point to a steady_clock + // time point and then back again produces approximately the same + // system_clock time_point. + auto t1 = SystemClock::now(); + auto t2 = convert_time_point(t1); + auto t3 = convert_time_point(t2); + auto difference = std::abs( + std::chrono::duration_cast(t3 - t1).count()); + CHECK(difference < 100); + } + + SECTION("Converting times from the same clock gives the identity") { + auto t = SystemClock::now(); + CHECK(t == convert_time_point(t)); + } +} -- cgit v1.2.3