1 // SPDX-License-Identifier: BSD-3-Clause
2 /*
3 * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
4 */
5
6 #include <CppUTest/TestHarness.h>
7 #include <CppUTestExt/MockSupport.h>
8 #include <stdint.h>
9 #include "mock_ffa_internal_api.h"
10
TEST_GROUP(mock_ffa_internal_api)11 TEST_GROUP(mock_ffa_internal_api)
12 {
13 TEST_TEARDOWN()
14 {
15 mock().checkExpectations();
16 mock().clear();
17 }
18 };
19
TEST(mock_ffa_internal_api,ffa_svc)20 TEST(mock_ffa_internal_api, ffa_svc)
21 {
22 const uint64_t a0 = 0x0123456789abcdefULL;
23 const uint64_t a1 = 0x123456789abcdef0ULL;
24 const uint64_t a2 = 0x23456789abcdef01ULL;
25 const uint64_t a3 = 0x3456789abcdef012ULL;
26 const uint64_t a4 = 0x456789abcdef0123ULL;
27 const uint64_t a5 = 0x56789abcdef01234ULL;
28 const uint64_t a6 = 0x6789abcdef012345ULL;
29 const uint64_t a7 = 0x789abcdef0123456ULL;
30 const struct ffa_params expect_result = {
31 a7, a6, a5, a4, a3, a2, a1, a0
32 };
33 struct ffa_params result = { 0 };
34
35 expect_ffa_svc(a0, a1, a2, a3, a4, a5, a6, a7, &expect_result);
36 ffa_svc(a0, a1, a2, a3, a4, a5, a6, a7, &result);
37
38 MEMCMP_EQUAL(&expect_result, &result, sizeof(result));
39 }
40