From 78fc2314c3537061d03eb67ce3c57305ec21b046 Mon Sep 17 00:00:00 2001 From: FactorialN Date: Sun, 15 Oct 2023 14:45:30 -0700 Subject: [PATCH] updated testing --- .gitignore | 8 +++++++- CMakeLists.txt | 5 +++-- CTestTestfile.cmake | 7 +++++++ cmake_install.cmake | 6 ++++++ fischl | Bin 33528 -> 33528 bytes include/fischl.h | 2 +- lib/fischl.cpp | 3 ++- test/CMakeLists.txt | 10 ++++++++++ test/CTestTestfile.cmake | 6 ++++++ test/testfischl.cpp | 13 +++++++++++++ 10 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 CTestTestfile.cmake create mode 100644 test/CMakeLists.txt create mode 100644 test/CTestTestfile.cmake create mode 100644 test/testfischl.cpp 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 3629ed38ffa9e257320aedf097b7c0bf4726c5ad..4604740e01ba6a728bd64b028514af8a7dafd392 100755 GIT binary patch delta 238 zcmey-%Jid^X~G3T33~t7_9l$4C+FISGfHeeYQN5bamM751{c8@bvj^kn1Ccd&|rzl zCmVhlz)WXM%PdaL$YGcmezg6O-rN;lUJ@3moxYiMzNuvk;}vdiO*xyxYk26%S*BET>mMV;w`2QzZOppZfa0Hn5j9lI%e%O1&2*P c>t^?)d$2v|)118BqgwuDi2UpW(O|~_0Q2NkWB>pF delta 237 zcmey-%Jid^X~G3T8G8l>Mg|6k6d(oxnT-$UGYNb$o3|rtv&G&1jk#AQ1%K1nJb}5x zdSU|0WC?o-7BL2fDU&ViO&H%y&b1F`l-YdLew_p3oXI5(E`oFFG{D9%0ZD$KxiXVa zHvBSx8P1rNS)81a!!YrAcj*zaK8^k>n{uX9PMlQu{%67B9bZ`)%KFwzUY*-8`E#R# z!b+h#I)`5$%6xOL-HB7ZYxT!&vL-SKu{|xK=JSE1< bUUo(*0zS-%i^8O)s!e~`*>>ZLG}ti!|7%%4 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