]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentracing-cpp/test/value_test.cpp
1 #include <opentracing/value.h>
2 using namespace opentracing
;
4 #define CATCH_CONFIG_MAIN
5 #include <opentracing/catch2/catch.hpp>
8 SECTION("Signed integers get converted to int64_t.") {
10 CHECK(v1
.is
<int64_t>());
12 Value
v2(static_cast<short>(123));
13 CHECK(v2
.is
<int64_t>());
16 SECTION("Unsigned integers get converted to uint64_t.") {
18 CHECK(v1
.is
<uint64_t>());
20 Value
v2(static_cast<unsigned short>(123));
21 CHECK(v2
.is
<uint64_t>());
24 SECTION("Bool values are deduced as bool.") {
26 // Workaround for "disabled expansion of recursive macro" warning.
27 const auto is_bool
= v1
.is
<bool>();
31 SECTION("Floating point numbers are converted to double.") {
33 CHECK(v1
.is
<double>());
35 CHECK(v2
.is
<double>());
38 SECTION("std::string values are deduced as std::string.") {
39 Value
v1(std::string("abc"));
40 CHECK(v1
.is
<std::string
>());
43 SECTION("c-string values are deduced as c-strings.") {
45 CHECK(v1
.is
<const char*>());
48 SECTION("Complex values are permitted.") {
49 Value
v1(Values
{Value(1), Value(2)});
52 Value
v2(Dictionary
{{"abc", Value(123)}});
56 SECTION("Value types can be compared for equality.") {
57 Value v1
{1}, v2
{2}, v3
{1.0};