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 | |
| 11 | #include <common.h> |
| 12 | #include <uuid.h> |
| 13 | #include <test/lib.h> |
| 14 | #include <test/test.h> |
| 15 | #include <test/ut.h> |
| 16 | |
| 17 | /* test UUID */ |
| 18 | #define TEST_SVC_UUID "ed32d533-4209-99e6-2d72-cdd998a79cc0" |
| 19 | |
| 20 | #define UUID_SIZE 16 |
| 21 | |
| 22 | /* The UUID binary data (little-endian format) */ |
| 23 | static const u8 ref_uuid_bin[UUID_SIZE] = { |
| 24 | 0x33, 0xd5, 0x32, 0xed, |
| 25 | 0x09, 0x42, 0xe6, 0x99, |
| 26 | 0x72, 0x2d, 0xc0, 0x9c, |
| 27 | 0xa7, 0x98, 0xd9, 0xcd |
| 28 | }; |
| 29 | |
| 30 | static int lib_test_uuid_to_le(struct unit_test_state *uts) |
| 31 | { |
| 32 | const char *uuid_str = TEST_SVC_UUID; |
| 33 | u8 ret_uuid_bin[UUID_SIZE] = {0}; |
| 34 | |
| 35 | ut_assertok(uuid_str_to_le_bin(uuid_str, ret_uuid_bin)); |
| 36 | ut_asserteq_mem(ref_uuid_bin, ret_uuid_bin, UUID_SIZE); |
| 37 | |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | LIB_TEST(lib_test_uuid_to_le, 0); |