Abdellatif El Khlifi | 10a69ce | 2023-08-04 14:33:39 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Functional tests for UCLASS_FFA class |
| 4 | * |
| 5 | * Copyright 2022-2023 Arm Limited and/or its affiliates <open-source-office@arm.com> |
| 6 | * |
| 7 | * Authors: |
| 8 | * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 9 | */ |
| 10 | |
Abdellatif El Khlifi | 10a69ce | 2023-08-04 14:33:39 +0100 | [diff] [blame] | 11 | #include <uuid.h> |
| 12 | #include <test/lib.h> |
| 13 | #include <test/test.h> |
| 14 | #include <test/ut.h> |
| 15 | |
| 16 | /* test UUID */ |
| 17 | #define TEST_SVC_UUID "ed32d533-4209-99e6-2d72-cdd998a79cc0" |
| 18 | |
| 19 | #define UUID_SIZE 16 |
| 20 | |
| 21 | /* The UUID binary data (little-endian format) */ |
| 22 | static const u8 ref_uuid_bin[UUID_SIZE] = { |
| 23 | 0x33, 0xd5, 0x32, 0xed, |
| 24 | 0x09, 0x42, 0xe6, 0x99, |
| 25 | 0x72, 0x2d, 0xc0, 0x9c, |
| 26 | 0xa7, 0x98, 0xd9, 0xcd |
| 27 | }; |
| 28 | |
| 29 | static int lib_test_uuid_to_le(struct unit_test_state *uts) |
| 30 | { |
| 31 | const char *uuid_str = TEST_SVC_UUID; |
| 32 | u8 ret_uuid_bin[UUID_SIZE] = {0}; |
| 33 | |
| 34 | ut_assertok(uuid_str_to_le_bin(uuid_str, ret_uuid_bin)); |
| 35 | ut_asserteq_mem(ref_uuid_bin, ret_uuid_bin, UUID_SIZE); |
| 36 | |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | LIB_TEST(lib_test_uuid_to_le, 0); |