FCF 2.0 development in progress...
> > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

FCF_TEST_IMPORT macro

FCF_TEST_IMPORT

Package: fcfTest

File: test.hpp

Available from version: 1.0.1

This macro is declared when importing fcfTest functions from a shared library (if you built fcfTest in a separate library) to inform the compiler that the functions should be imported.

It's best to declare this macro in the settings for CMake, Visual Studio, and other build systems.

Example: Connecting an fcfTest from an external shared library.

main.cpp:

Our application file

#define FCF_TEST_IMPORT #include <fcfTest/test.hpp> FCF_TEST_DEFINE("OurPart", "OurGroup","OurTest"){ int a = 1; int b = 2; FCF_TEST(a !=b, a, b); } int main(int a_argc, char* a_argv[]){ bool error; fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error); return error ? 1 : 0; }

shared.cpp file:

Our shared library

#define FCF_TEST_EXPORT #define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp>

CMakeLists.txt file:

project(FcfTestProject) # 1. Create a dynamic shared library add_library(my_shared_lib SHARED shared.cpp) # Specify include directories for the library target_include_directories(my_shared_lib PRIVATE ../../..) # 2. Create the application executable add_executable(app main.cpp) # Specify include directories for the application target_include_directories(app PRIVATE ../../..) # 3. Link the application with the created library target_link_libraries(app PRIVATE my_shared_lib)

Output:

Performing the test: "OurPart" -> "OurGroup" -> "OurTest" ... [SUCCESS] Test completed successfully (0.000`000`982 sec) [SUCCESS] All tests were completed. Tests: 1 passed, 0 failed, 0 skipped, 1 total Duration: 0.000`000`982 sec