summaryrefslogtreecommitdiffstats
path: root/test/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2021-09-03 01:39:27 +0200
committerSven Gothel <[email protected]>2021-09-03 01:39:27 +0200
commit897cf8fa26812f5587efc01a7223219fb0594dce (patch)
tree044fd8d55706fb78f34bd7f0f85513351fc5aaee /test/direct_bt
parente0e469b3bd3f4332488b75334b1326a0a452dce8 (diff)
uuid_t: Add ctor(string) for all specialisations and add uuid_t::create(const string&) for convenience
Diffstat (limited to 'test/direct_bt')
-rw-r--r--test/direct_bt/test_uuid.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/direct_bt/test_uuid.cpp b/test/direct_bt/test_uuid.cpp
index 44c43f4a..da1abafa 100644
--- a/test/direct_bt/test_uuid.cpp
+++ b/test/direct_bt/test_uuid.cpp
@@ -59,4 +59,45 @@ TEST_CASE( "UUID Test 01", "[datatype][uuid]" ) {
REQUIRE( 0 == memcmp(v01.data(), v02->data(), 2) );
REQUIRE( v01.toString() == v02->toString() );
}
+
+
+
+ {
+ const uuid16_t v01("1234");
+ REQUIRE(v01.getTypeSizeInt() == uuid_t::number( uuid_t::TypeSize::UUID16_SZ ));
+ REQUIRE(v01.getTypeSizeInt() == sizeof(v01.value));
+ REQUIRE(0x1234 == v01.value);
+ REQUIRE("1234" == v01.toString());
+ }
+ {
+ const uuid32_t v01("12345678");
+ REQUIRE(v01.getTypeSizeInt() == uuid_t::number( uuid_t::TypeSize::UUID32_SZ ));
+ REQUIRE(v01.getTypeSizeInt() == sizeof(v01.value));
+ REQUIRE(0x12345678 == v01.value);
+ REQUIRE("12345678" == v01.toString());
+ }
+ {
+ const uuid128_t v01("00001234-5678-100A-800B-00805F9B34FB");
+ REQUIRE(v01.getTypeSizeInt() == uuid_t::number( uuid_t::TypeSize::UUID128_SZ) );
+ REQUIRE(v01.getTypeSizeInt() == sizeof(v01.value));
+ REQUIRE("00001234-5678-100a-800b-00805f9b34fb" == v01.toString());
+ }
+
+
+
+ {
+ std::shared_ptr<const uuid_t> v01 = uuid_t::create("1234");
+ REQUIRE(v01->getTypeSizeInt() == uuid_t::number( uuid_t::TypeSize::UUID16_SZ ));
+ REQUIRE("1234" == v01->toString());
+ }
+ {
+ std::shared_ptr<const uuid_t> v01 = uuid_t::create("12345678");
+ REQUIRE(v01->getTypeSizeInt() == uuid_t::number( uuid_t::TypeSize::UUID32_SZ));
+ REQUIRE("12345678" == v01->toString());
+ }
+ {
+ std::shared_ptr<const uuid_t> v01 = uuid_t::create("00001234-5678-100A-800B-00805F9B34FB");
+ REQUIRE(v01->getTypeSizeInt() == uuid_t::number( uuid_t::TypeSize::UUID128_SZ ));
+ REQUIRE("00001234-5678-100a-800b-00805f9b34fb" == v01->toString());
+ }
}