Setup Basic Testing Framework
This commit is contained in:
@@ -9,4 +9,15 @@ add_executable(NameSort src/main.c
|
||||
include/name_string.h
|
||||
include/string_vector.h include/file_io.h src/file_io.c include/constants.h)
|
||||
|
||||
target_include_directories(NameSort PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
||||
# Copy executable to test directory after compilation for ease of testing
|
||||
add_custom_command(TARGET NameSort POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:NameSort> ${CMAKE_SOURCE_DIR}/test/)
|
||||
|
||||
target_include_directories(NameSort PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
# After everything has been built, we want to automatically run tests as part of the build
|
||||
add_custom_command(
|
||||
TARGET NameSort
|
||||
POST_BUILD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/test
|
||||
COMMAND cmd //C Test.bat
|
||||
)
|
||||
BIN
test/NameSort.exe
Normal file
BIN
test/NameSort.exe
Normal file
Binary file not shown.
50
test/Sorted.txt
Normal file
50
test/Sorted.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
Kha
|
||||
Asby
|
||||
Bain
|
||||
Dean
|
||||
Fife
|
||||
Wile
|
||||
Baker
|
||||
Ellis
|
||||
Evans
|
||||
Foley
|
||||
Glock
|
||||
Graff
|
||||
Heigl
|
||||
Lundy
|
||||
McVey
|
||||
Nylon
|
||||
Peery
|
||||
Reyes
|
||||
White
|
||||
Adkins
|
||||
Broome
|
||||
Hickey
|
||||
Laymon
|
||||
Rogers
|
||||
Tanton
|
||||
Taylor
|
||||
Byfield
|
||||
Dulaney
|
||||
Hagberg
|
||||
Hillman
|
||||
McCrave
|
||||
Michael
|
||||
Padgett
|
||||
Routson
|
||||
Starkey
|
||||
Stegman
|
||||
Bostwick
|
||||
Cachedon
|
||||
Giddings
|
||||
Guenther
|
||||
Hatfield
|
||||
Kalivoda
|
||||
Kirkland
|
||||
Phillips
|
||||
Reynolds
|
||||
Sullivan
|
||||
Williams
|
||||
Clevenger
|
||||
Fitzjerrell
|
||||
Hendrickson
|
||||
8
test/Test.bat
Normal file
8
test/Test.bat
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
NameSort.exe "Sort Me.txt" > Output.txt
|
||||
fc Output.txt Sorted.txt
|
||||
if errorlevel 1 {
|
||||
echo "Test Failure"
|
||||
} else {
|
||||
echo "Test Success"
|
||||
}
|
||||
Reference in New Issue
Block a user