diff options
author | 2022-07-21 07:14:31 +0900 | |
---|---|---|
committer | 2022-08-05 00:35:12 +0900 | |
commit | b0ed05f610e4bf70eae7929163e1ac8794bd15b0 (patch) | |
tree | fa0d21d6fec4e8b6c0393776afbabdb592e78c41 /test/interface_test_unit_memory.cpp | |
parent | eb7fddaec547c4c9d47cee77bd5419d34ab5f1df (diff) |
Update test case
Ths patch update tase case
Bug-AGL: SPEC-4500
Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Change-Id: I27b4a537d522198f5f180ce22fb7f0af95b3ddb8
Diffstat (limited to 'test/interface_test_unit_memory.cpp')
-rw-r--r-- | test/interface_test_unit_memory.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/interface_test_unit_memory.cpp b/test/interface_test_unit_memory.cpp new file mode 100644 index 0000000..ec61c13 --- /dev/null +++ b/test/interface_test_unit_memory.cpp @@ -0,0 +1,40 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + * + * @file interface_test_unit_memory.cpp + * @brief Unit test fot libredundancyfileop.c + */ +#include <gtest/gtest.h> +#include "mock/syscall_io_mock.hpp" +#include "mock/memory_mock.hpp" + +// Test Terget files --------------------------------------- +extern "C" { +#define malloc(X) unittest_malloc(X) +#include "../lib/libredundancyfileop.c" +#undef malloc +} +// Test Terget files --------------------------------------- +using namespace ::testing; + +struct interface_test_unit_memory_test : Test, SyscallIOMockBase, MemoryMockBase {}; + +//-------------------------------------------------------------------------------------------------------- +TEST_F(interface_test_unit_memory_test, interface_test_unit_memory_test_refop_create_redundancy_handle__malloc_error) +{ + refop_error_t ret = REFOP_SUCCESS; + refop_handle_t handle = NULL; + + //dummy data + char directry[PATH_MAX]; + char file[PATH_MAX]; + + memset(directry,0,sizeof(directry)); + memset(file,0,sizeof(file)); + + //short directry string + EXPECT_CALL(sysiom, stat(directry, _)).WillOnce(Return(0)); + EXPECT_CALL(memorym, malloc(_)).WillOnce(Return(NULL)); + ret = refop_create_redundancy_handle(&handle, directry, file); + ASSERT_EQ(REFOP_SYSERROR, ret); +} |