-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2641d17
commit 5dca78e
Showing
2 changed files
with
87 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,72 @@ | ||
# Declare variables for binaries' names | ||
get_filename_component(DIR_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) | ||
set(MODULE "${DIR_NAME}") | ||
set(LIBRARY "lib_${MODULE}") | ||
set(TESTS "test_${MODULE}") | ||
set(APPLICATION "app_${MODULE}") | ||
# Set the prefix for your tests | ||
set(prefix "fibonacci_heap") | ||
|
||
# Include directory with public headers | ||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
# Test the run() function | ||
add_test( | ||
NAME ${prefix}_run | ||
COMMAND ${APPLICATION} | ||
) | ||
set_tests_properties(${prefix}_run PROPERTIES | ||
PASS_REGULAR_EXPRESSION "Fibonacci Heap Operations:" | ||
LABELS "${prefix}" | ||
) | ||
|
||
# Add all submodules | ||
add_subdirectory(src) | ||
add_subdirectory(test) | ||
add_subdirectory(application) | ||
# Test the insert operation | ||
add_test( | ||
NAME ${prefix}_insert | ||
COMMAND ${APPLICATION} --insert | ||
) | ||
set_tests_properties(${prefix}_insert PROPERTIES | ||
PASS_REGULAR_EXPRESSION "Element inserted successfully." | ||
LABELS "${prefix}" | ||
) | ||
|
||
############################################# | ||
##### Testing | ||
############################################# | ||
# Test the extract minimum operation | ||
add_test( | ||
NAME ${prefix}_extract_min | ||
COMMAND ${APPLICATION} --extract | ||
) | ||
set_tests_properties(${prefix}_extract_min PROPERTIES | ||
PASS_REGULAR_EXPRESSION "Minimum element extracted:" | ||
LABELS "${prefix}" | ||
) | ||
|
||
include("CTestTests.txt") | ||
# Test the decrease key operation | ||
add_test( | ||
NAME ${prefix}_decrease_key | ||
COMMAND ${APPLICATION} --decrease 0 10 | ||
) | ||
set_tests_properties(${prefix}_decrease_key PROPERTIES | ||
PASS_REGULAR_EXPRESSION "Key decreased successfully." | ||
LABELS "${prefix}" | ||
) | ||
|
||
# Test the delete node operation | ||
add_test( | ||
NAME ${prefix}_delete_node | ||
COMMAND ${APPLICATION} --delete 0 | ||
) | ||
set_tests_properties(${prefix}_delete_node PROPERTIES | ||
PASS_REGULAR_EXPRESSION "Node deleted successfully." | ||
LABELS "${prefix}" | ||
) | ||
|
||
# Test the merge heaps operation | ||
add_test( | ||
NAME ${prefix}_merge_heaps | ||
COMMAND ${APPLICATION} --merge 2 10 20 | ||
) | ||
set_tests_properties(${prefix}_merge_heaps PROPERTIES | ||
PASS_REGULAR_EXPRESSION "Heaps merged successfully." | ||
LABELS "${prefix}" | ||
) | ||
|
||
# Test the invalid input | ||
add_test( | ||
NAME ${prefix}_invalid_input | ||
COMMAND ${APPLICATION} --invalid | ||
) | ||
set_tests_properties(${prefix}_invalid_input PROPERTIES | ||
PASS_REGULAR_EXPRESSION "Invalid choice. Please try again." | ||
LABELS "${prefix}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters