File: test-uuid.cpp

package info (click to toggle)
babeltrace2 2.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 42,660 kB
  • sloc: cpp: 106,162; ansic: 78,276; python: 27,115; sh: 9,053; makefile: 1,807; xml: 46
file content (35 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 * SPDX-License-Identifier: GPL-2.0-only
 *
 * Copyright (C) 2024 EfficiOS, Inc.
 */

#include "cpp-common/bt2c/fmt.hpp"
#include "cpp-common/bt2c/uuid.hpp"
#include "cpp-common/vendor/fmt/format.h"

#include "tap/tap.h"

namespace {

constexpr auto uuidStr = "c2281e4a-699b-4b78-903f-2f8407fe2b77";
const bt2c::Uuid uuid {uuidStr};
const bt2c::UuidView uuidView {uuid};

void testFormatAs()
{
    const auto resUuid = fmt::to_string(uuid);
    const auto resUuidView = fmt::to_string(uuidView);

    ok(resUuid == uuidStr, "result of format_as() for `Uuid` is expected");
    ok(resUuidView == uuidStr, "result of format_as() for `UuidView` is expected");
}

} /* namespace */

int main()
{
    plan_tests(2);
    testFormatAs();
    return exit_status();
}