| 1 | /* |
| 2 | * SPDX-License-Identifier: GPL-2.0-only |
| 3 | * |
| 4 | * Copyright (C) 2024 EfficiOS, Inc. |
| 5 | */ |
| 6 | |
| 7 | #include "cpp-common/bt2c/fmt.hpp" |
| 8 | #include "cpp-common/bt2c/uuid.hpp" |
| 9 | #include "cpp-common/vendor/fmt/format.h" |
| 10 | |
| 11 | #include "tap/tap.h" |
| 12 | |
| 13 | namespace { |
| 14 | |
| 15 | constexpr auto uuidStr = "c2281e4a-699b-4b78-903f-2f8407fe2b77"; |
| 16 | const bt2c::Uuid uuid {uuidStr}; |
| 17 | const bt2c::UuidView uuidView {uuid}; |
| 18 | |
| 19 | void testFormatAs() |
| 20 | { |
| 21 | const auto resUuid = fmt::to_string(uuid); |
| 22 | const auto resUuidView = fmt::to_string(uuidView); |
| 23 | |
| 24 | ok(resUuid == uuidStr, "result of format_as() for `Uuid` is expected"); |
| 25 | ok(resUuidView == uuidStr, "result of format_as() for `UuidView` is expected"); |
| 26 | } |
| 27 | |
| 28 | } /* namespace */ |
| 29 | |
| 30 | int main() |
| 31 | { |
| 32 | plan_tests(2); |
| 33 | testFormatAs(); |
| 34 | return exit_status(); |
| 35 | } |