From 52450ed3034b0ba058ea2c9f9baa2d5f78df6a94 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 17 Nov 2018 22:38:32 +0100 Subject: apps/ble-bts: o Adding start of health termometer service tool. apps/ble-read-characteristic: o Sart of new tool. apps/ble-inspect-device o Make adapter configurable. other: o UUID fixes and tests. --- test/UuidTest.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/UuidTest.cpp (limited to 'test') diff --git a/test/UuidTest.cpp b/test/UuidTest.cpp new file mode 100644 index 0000000..b31c121 --- /dev/null +++ b/test/UuidTest.cpp @@ -0,0 +1,29 @@ +#include "ble/Bluetooth.h" + +#define BOOST_TEST_MODULE "UuidTest" + +#include + +using namespace std; +using namespace trygvis::bluetooth; + +BOOST_AUTO_TEST_CASE(uuid) { + BOOST_CHECK_EQUAL("0001", ShortUuid{0x01}.str()); + BOOST_CHECK_EQUAL("2a1c", uuids::TemperatureMeasurement.str()); + BOOST_CHECK_EQUAL("00001809-0000-1000-8000-00805f9b34fb", uuids::HealthTermometerService.toLong().str()); +} + +BOOST_AUTO_TEST_CASE(fromString) { + auto o = Uuid::fromString("abcd"); + BOOST_CHECK(!!o); + if (o) { + BOOST_CHECK_EQUAL(ShortUuid(0xabcd).toLong().str(), o.value().str()); + } + + o = Uuid::fromString("0xabcd"); + BOOST_CHECK(!o); + + o = Uuid::fromString("00001809-0000-1000-8000-00805f9b34fb"); + BOOST_CHECK(!!o); + BOOST_CHECK_EQUAL(o.value().str(), uuids::HealthTermometerService.toLong().str()); +} -- cgit v1.2.3