1 /* Copyright (c) 2019 Intel Corporation
2  * SPDX-License-Identifier: Apache-2.0
3  */
4 
5 #include <stdint.h>
6 #include <zephyr/ztest.h>
7 #include <zephyr/bluetooth/uuid.h>
8 
9 static struct bt_uuid_16 uuid_16 = BT_UUID_INIT_16(0xffff);
10 
11 static struct bt_uuid_128 uuid_128 = BT_UUID_INIT_128(
12 	0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
13 	0x00, 0x10, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00);
14 
15 ZTEST_SUITE(bt_uuid_cmp, NULL, NULL, NULL, NULL, NULL);
16 
ZTEST(bt_uuid_cmp,test_uuid_cmp)17 ZTEST(bt_uuid_cmp, test_uuid_cmp)
18 {
19 	/* Compare UUID 16 bits */
20 	zassert_false(bt_uuid_cmp(&uuid_16.uuid, BT_UUID_DECLARE_16(0xffff)),
21 		     "Test UUIDs don't match");
22 
23 	/* Compare UUID 128 bits */
24 	zassert_false(bt_uuid_cmp(&uuid_128.uuid, BT_UUID_DECLARE_16(0xffff)),
25 		     "Test UUIDs don't match");
26 
27 	/* Compare UUID 16 bits with UUID 128 bits */
28 	zassert_false(bt_uuid_cmp(&uuid_16.uuid, &uuid_128.uuid),
29 		     "Test UUIDs don't match");
30 
31 	/* Compare different UUID 16 bits */
32 	zassert_true(bt_uuid_cmp(&uuid_16.uuid, BT_UUID_DECLARE_16(0x0000)),
33 		     "Test UUIDs match");
34 
35 	/* Compare different UUID 128 bits */
36 	zassert_true(bt_uuid_cmp(&uuid_128.uuid, BT_UUID_DECLARE_16(0x000)),
37 		     "Test UUIDs match");
38 }
39