Skip to content

Commit

Permalink
Refactor test/ directory to match the rest of the project.
Browse files Browse the repository at this point in the history
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 <peress@google.com>
  • Loading branch information
yperess committed Aug 28, 2022
1 parent 4884422 commit 1f6a3c8
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
24 changes: 14 additions & 10 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions test/global_fakes.h → test/include/global_fakes.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef GLOBAL_FAKES_H_
#define GLOBAL_FAKES_H_

#include "fff.h"
#include "string.h"
#include <fff.h>
#include <string.h>


//// Imaginary production code header file ///
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion test/fff_test_cpp.cpp → test/src/fff_test_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#define FFF_CALL_HISTORY_LEN OVERRIDE_CALL_HIST_LEN

#include "fff.h"
#include <gtest/gtest.h>
#include "gtest/gtest.h"

DEFINE_FFF_GLOBALS

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extern "C"{
#include "global_fakes.h"
}
#include <gtest/gtest.h>
#include "gtest/gtest.h"

DEFINE_FFF_GLOBALS;

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 1f6a3c8

Please sign in to comment.