13 static uint8_t uuid128_bytes[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
14 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB };
21 REQUIRE( 0 == memcmp(uuid128_bytes, v01.
data(), 16) );
25 REQUIRE(v02->getTypeSizeInt() == 16);
26 REQUIRE( 0 == memcmp(v01.
data(), v02->data(), 16) );
27 REQUIRE( v01.
toString() == v02->toString() );
34 REQUIRE(0x12345678 == v01.
value);
38 REQUIRE(v02->getTypeSizeInt() == 4);
39 REQUIRE( 0 == memcmp(v01.
data(), v02->data(), 4) );
40 REQUIRE( v01.
toString() == v02->toString() );
47 REQUIRE(0x1234 == v01.
value);
51 REQUIRE(v02->getTypeSizeInt() == 2);
52 REQUIRE( 0 == memcmp(v01.
data(), v02->data(), 2) );
53 REQUIRE( v01.
toString() == v02->toString() );
59 const uuid128_t v01(
"00001234-5678-100A-800B-00805F9B34FB");
62 REQUIRE(
"00001234-5678-100a-800b-00805f9b34fb" == v01.
toString());
63 REQUIRE(
uuid128_t(
"00001234-5678-100a-800b-00805f9b34fb") == v01);
64 REQUIRE(
uuid128_t(
"00001234-5678-100a-800b-00805f9b34fc") != v01);
70 REQUIRE(0x1234 == v01.
value);
74 REQUIRE(v01_copy == v01);
78 const uuid128_t v02(
"00001234-0000-1000-8000-00805F9B34FB");
79 REQUIRE(v01_128 == v02);
87 REQUIRE(0x12345678 == v01.
value);
88 REQUIRE(
"12345678" == v01.
toString());
91 REQUIRE(v01_copy == v01);
92 REQUIRE(
uuid32_t(
"12345679") != v01);
95 const uuid128_t v02(
"12345678-0000-1000-8000-00805F9B34FB");
96 REQUIRE(v01_128 == v02);
105 std::shared_ptr<const uuid_t> v01 = uuid_t::create(
"1234");
106 REQUIRE(v01->getTypeSizeInt() ==
uuid_t::number( uuid_t::TypeSize::UUID16_SZ ));
107 REQUIRE(
"1234" == v01->toString());
110 std::shared_ptr<const uuid_t> v01 = uuid_t::create(
"12345678");
111 REQUIRE(v01->getTypeSizeInt() ==
uuid_t::number( uuid_t::TypeSize::UUID32_SZ));
112 REQUIRE(
"12345678" == v01->toString());
115 std::shared_ptr<const uuid_t> v01 = uuid_t::create(
"00001234-5678-100A-800B-00805F9B34FB");
116 REQUIRE(v01->getTypeSizeInt() ==
uuid_t::number( uuid_t::TypeSize::UUID128_SZ ));
117 REQUIRE(
"00001234-5678-100a-800b-00805f9b34fb" == v01->toString());
std::string toString() const noexcept override
Returns the string representation in BE network order, i.e.
jau::nsize_t put(uint8_t *const buffer, lb_endian_t const le_or_be) const noexcept override
const uint8_t * data() const noexcept override
returns the pointer to the uuid data of size getTypeSize()
const uint8_t * data() const noexcept override
returns the pointer to the uuid data of size getTypeSize()
jau::nsize_t put(uint8_t *const buffer, lb_endian_t const le_or_be) const noexcept override
std::string toString() const noexcept override
Returns the string representation in BE network order, i.e.
std::string toString() const noexcept override
Returns the string representation in BE network order, i.e.
jau::nsize_t put(uint8_t *const buffer, lb_endian_t const le_or_be) const noexcept override
const uint8_t * data() const noexcept override
returns the pointer to the uuid data of size getTypeSize()
uuid128_t toUUID128(uuid128_t const &base_uuid=BT_BASE_UUID, jau::nsize_t const uuid32_le_octet_index=12) const noexcept
jau::nsize_t getTypeSizeInt() const noexcept
bool equivalent(uuid_t const &o) const noexcept
Relaxed equality operator.
@ little
Identifier for little endian, equivalent to endian::little.
constexpr uint32_t number(const iostate rhs) noexcept
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
TEST_CASE("UUID Test 01", "[datatype][uuid]")