1 //
2 // Copyright (C) 2025 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #include <gtest/gtest.h>
17
18 #include "nfa_mem_co.h"
19 #include "nfa_nv_co.h"
20 #include "nfc_hal_nv_co.h"
21
22 extern void verify_stack_non_volatile_store();
23 extern void delete_stack_non_volatile_store(bool forceDelete);
24
TEST(LibmainTest,buffer)25 TEST(LibmainTest, buffer) {
26 void* buffer;
27 buffer = nfa_mem_co_alloc(0xFF);
28 EXPECT_NE(buffer, nullptr);
29 nfa_nv_co_write((uint8_t*)buffer, sizeof(buffer), HC_F2_NV_BLOCK);
30 nfa_nv_co_read((uint8_t*)buffer, sizeof(buffer), HC_F2_NV_BLOCK);
31 nfa_mem_co_free(buffer);
32 }
33
TEST(LibmainTest,VerifyStack)34 TEST(LibmainTest, VerifyStack) {
35 verify_stack_non_volatile_store();
36 delete_stack_non_volatile_store(true);
37 }