From 1f6a3c833153fe5bc2e7d9b40a2b90dd348b86a5 Mon Sep 17 00:00:00 2001 From: Yuval Peress Date: Thu, 11 Aug 2022 11:26:55 -0600 Subject: [PATCH] Refactor test/ directory to match the rest of the project. The prior PR didn't touch this directory because it was getting too big and I wanted the diff to be smaller for the test directory. Now addressing that. Signed-off-by: Yuval Peress --- test/CMakeLists.txt | 24 ++++++++++++++---------- test/{ => include}/c_test_framework.h | 0 test/{ => include}/global_fakes.h | 4 ++-- test/{ => src}/fff_test_c.c | 0 test/{ => src}/fff_test_cpp.cpp | 2 +- test/{ => src}/fff_test_global_c.c | 0 test/{ => src}/fff_test_global_cpp.cpp | 2 +- test/{ => src}/global_fakes.c | 0 test/{ => src}/test_cases.include | 0 9 files changed, 18 insertions(+), 14 deletions(-) rename test/{ => include}/c_test_framework.h (100%) rename test/{ => include}/global_fakes.h (98%) rename test/{ => src}/fff_test_c.c (100%) rename test/{ => src}/fff_test_cpp.cpp (99%) rename test/{ => src}/fff_test_global_c.c (100%) rename test/{ => src}/fff_test_global_cpp.cpp (94%) rename test/{ => src}/global_fakes.c (100%) rename test/{ => src}/test_cases.include (100%) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0aa6679..995ba7d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,34 +4,38 @@ # Create a list of common files needed for tests set( COMMON_FILE_LIST - c_test_framework.h - test_cases.include + include/c_test_framework.h + src/test_cases.include ) # Create the C test executable -add_executable(c_test fff_test_c.c ${COMMON_FILE_LIST}) +add_executable(c_test src/fff_test_c.c ${COMMON_FILE_LIST}) +target_include_directories(c_test PRIVATE include) target_link_libraries(c_test PRIVATE fff) # Create the C++ test executable -add_executable(cpp_test fff_test_cpp.cpp ${COMMON_FILE_LIST}) +add_executable(cpp_test src/fff_test_cpp.cpp ${COMMON_FILE_LIST}) +target_include_directories(cpp_test PRIVATE include) target_link_libraries(cpp_test PRIVATE gtest fff) # Create the C global test executable add_executable(c_global_test - fff_test_global_c.c - global_fakes.c - global_fakes.h + src/fff_test_global_c.c + src/global_fakes.c + include/global_fakes.h ${COMMON_FILE_LIST} ) +target_include_directories(c_global_test PRIVATE include) target_link_libraries(c_global_test PRIVATE fff) # Create the C++ global test executable add_executable(cpp_global_test - fff_test_global_cpp.cpp - global_fakes.c - global_fakes.h + src/fff_test_global_cpp.cpp + src/global_fakes.c + include/global_fakes.h ${COMMON_FILE_LIST} ) +target_include_directories(cpp_global_test PRIVATE include) target_link_libraries(cpp_global_test PRIVATE gtest fff) # Add the tests for ctest diff --git a/test/c_test_framework.h b/test/include/c_test_framework.h similarity index 100% rename from test/c_test_framework.h rename to test/include/c_test_framework.h diff --git a/test/global_fakes.h b/test/include/global_fakes.h similarity index 98% rename from test/global_fakes.h rename to test/include/global_fakes.h index 0530dd2..b76a9aa 100644 --- a/test/global_fakes.h +++ b/test/include/global_fakes.h @@ -1,8 +1,8 @@ #ifndef GLOBAL_FAKES_H_ #define GLOBAL_FAKES_H_ -#include "fff.h" -#include "string.h" +#include +#include //// Imaginary production code header file /// diff --git a/test/fff_test_c.c b/test/src/fff_test_c.c similarity index 100% rename from test/fff_test_c.c rename to test/src/fff_test_c.c diff --git a/test/fff_test_cpp.cpp b/test/src/fff_test_cpp.cpp similarity index 99% rename from test/fff_test_cpp.cpp rename to test/src/fff_test_cpp.cpp index b387ae2..153daef 100644 --- a/test/fff_test_cpp.cpp +++ b/test/src/fff_test_cpp.cpp @@ -13,7 +13,7 @@ #define FFF_CALL_HISTORY_LEN OVERRIDE_CALL_HIST_LEN #include "fff.h" -#include +#include "gtest/gtest.h" DEFINE_FFF_GLOBALS diff --git a/test/fff_test_global_c.c b/test/src/fff_test_global_c.c similarity index 100% rename from test/fff_test_global_c.c rename to test/src/fff_test_global_c.c diff --git a/test/fff_test_global_cpp.cpp b/test/src/fff_test_global_cpp.cpp similarity index 94% rename from test/fff_test_global_cpp.cpp rename to test/src/fff_test_global_cpp.cpp index f2cf79e..bb4993d 100644 --- a/test/fff_test_global_cpp.cpp +++ b/test/src/fff_test_global_cpp.cpp @@ -2,7 +2,7 @@ extern "C"{ #include "global_fakes.h" } -#include +#include "gtest/gtest.h" DEFINE_FFF_GLOBALS; diff --git a/test/global_fakes.c b/test/src/global_fakes.c similarity index 100% rename from test/global_fakes.c rename to test/src/global_fakes.c diff --git a/test/test_cases.include b/test/src/test_cases.include similarity index 100% rename from test/test_cases.include rename to test/src/test_cases.include