diff --git a/.gitignore b/.gitignore index eda81bf..a9ddaf8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ Makefile /CMakeFiles CMakeCache.txt -cmake_install_cmake \ No newline at end of file +cmake_install.cmake +fischl +/test/CMakeFiles +/test/cmake_install.cmake +/test/CMakeCache.txt +/test/Makefile +run_tests \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b845f83..36b3d39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,10 @@ include_directories( add_executable(fischl # Header files - - include/fischl.h lib/fischl.cpp lib/main.cpp ) + +enable_testing() +add_subdirectory(test) diff --git a/CTestTestfile.cmake b/CTestTestfile.cmake new file mode 100644 index 0000000..76de908 --- /dev/null +++ b/CTestTestfile.cmake @@ -0,0 +1,7 @@ +# CMake generated Testfile for +# Source directory: /Users/factorialn/Projects/iloveos +# Build directory: /Users/factorialn/Projects/iloveos +# +# This file includes the relevant testing commands required for +# testing this directory and lists subdirectories to be tested as well. +subdirs("test") diff --git a/cmake_install.cmake b/cmake_install.cmake index c2b2fc6..e16ca35 100644 --- a/cmake_install.cmake +++ b/cmake_install.cmake @@ -37,6 +37,12 @@ if(NOT DEFINED CMAKE_OBJDUMP) set(CMAKE_OBJDUMP "/Library/Developer/CommandLineTools/usr/bin/objdump") endif() +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for each subdirectory. + include("/Users/factorialn/Projects/iloveos/test/cmake_install.cmake") + +endif() + if(CMAKE_INSTALL_COMPONENT) set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") else() diff --git a/fischl b/fischl index 3629ed3..4604740 100755 Binary files a/fischl and b/fischl differ diff --git a/include/fischl.h b/include/fischl.h index 2110f2b..7226576 100644 --- a/include/fischl.h +++ b/include/fischl.h @@ -2,6 +2,6 @@ class fischl{ // declare public: - void init(); + int init(); }; \ No newline at end of file diff --git a/lib/fischl.cpp b/lib/fischl.cpp index 416fd39..3cc7ad7 100644 --- a/lib/fischl.cpp +++ b/lib/fischl.cpp @@ -2,6 +2,7 @@ #include -void fischl::init(){ +int fischl::init(){ printf("Hello Fischl!"); + return 3; } \ No newline at end of file diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..fd0a947 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,10 @@ +set(TARGET_NAME run_tests) + + +# add test sources here ... +add_executable(${TARGET_NAME} + + ../lib/fischl.cpp + testfischl.cpp + +) \ No newline at end of file diff --git a/test/CTestTestfile.cmake b/test/CTestTestfile.cmake new file mode 100644 index 0000000..de1478e --- /dev/null +++ b/test/CTestTestfile.cmake @@ -0,0 +1,6 @@ +# CMake generated Testfile for +# Source directory: /Users/factorialn/Projects/iloveos/test +# Build directory: /Users/factorialn/Projects/iloveos/test +# +# This file includes the relevant testing commands required for +# testing this directory and lists subdirectories to be tested as well. diff --git a/test/testfischl.cpp b/test/testfischl.cpp new file mode 100644 index 0000000..541aa97 --- /dev/null +++ b/test/testfischl.cpp @@ -0,0 +1,13 @@ +#include "fischl.h" +#include + +void testFischlInit(){ + fischl *F = new fischl; + assert(F->init()==3); + delete F; +} + +int main(){ + testFischlInit(); + return 0; +} \ No newline at end of file