Merge pull request #2 from SuperconductZB/guangzheliu/inittest

updated testing
This commit is contained in:
FactorialN 2023-10-15 14:50:02 -07:00 committed by GitHub
commit e7d6960f13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 55 additions and 5 deletions

8
.gitignore vendored
View File

@ -1,4 +1,10 @@
Makefile
/CMakeFiles
CMakeCache.txt
cmake_install_cmake
cmake_install.cmake
fischl
/test/CMakeFiles
/test/cmake_install.cmake
/test/CMakeCache.txt
/test/Makefile
run_tests

View File

@ -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)

7
CTestTestfile.cmake Normal file
View File

@ -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")

View File

@ -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()

BIN
fischl

Binary file not shown.

View File

@ -2,6 +2,6 @@ class fischl{
// declare
public:
void init();
int init();
};

View File

@ -2,6 +2,7 @@
#include <cstdio>
void fischl::init(){
int fischl::init(){
printf("Hello Fischl!");
return 3;
}

10
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
set(TARGET_NAME run_tests)
# add test sources here ...
add_executable(${TARGET_NAME}
../lib/fischl.cpp
testfischl.cpp
)

6
test/CTestTestfile.cmake Normal file
View File

@ -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.

13
test/testfischl.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "fischl.h"
#include <assert.h>
void testFischlInit(){
fischl *F = new fischl;
assert(F->init()==3);
delete F;
}
int main(){
testFischlInit();
return 0;
}