Skip to content

Commit

Permalink
Bump CMakeTest and update test naming scheme (#126)
Browse files Browse the repository at this point in the history
* Bump CMakeTest to v0.1.8

* Convert tests to new test naming scheme
  • Loading branch information
AutonomicPerfectionist authored Nov 6, 2023
1 parent 2048668 commit 789faf6
Show file tree
Hide file tree
Showing 105 changed files with 2,043 additions and 2,043 deletions.
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include(cmaize/cmaize)
FetchContent_Declare(
cmake_test
GIT_REPOSITORY https://github.com/CMakePP/CMakeTest
GIT_TAG 99901a11adda1b21abed7941c10641b2b03c11ad
GIT_TAG v0.1.8
)
set(build_testing_old "${BUILD_TESTING}")
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
Expand Down
52 changes: 26 additions & 26 deletions tests/algorithm/contains.cmake
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
include(cmake_test/cmake_test)

ct_add_test(NAME "test_cpp_contains")
function("${test_cpp_contains}")
ct_add_test(NAME [[test_cpp_contains]])
function("${CMAKETEST_TEST}")
include(cmakepp_lang/algorithm/contains)

ct_add_section(NAME "signature")
function("${signature}")
ct_add_section(NAME [[signature]])
function("${CMAKETEST_SECTION}")
set(CMAKEPP_LANG_DEBUG_MODE ON)

ct_add_section(NAME "arg_must_be_desc" EXPECTFAIL)
function("${arg_must_be_desc}")
ct_add_section(NAME [[arg_must_be_desc]] EXPECTFAIL)
function("${CMAKETEST_SECTION}")
cpp_contains(TRUE an_item a_list)
endfunction()

ct_add_section(NAME "three_args" EXPECTFAIL)
function("${three_args}")
ct_add_section(NAME [[three_args]] EXPECTFAIL)
function("${CMAKETEST_SECTION}")
cpp_contains(result an_item a_list hello)
endfunction()
endfunction()

ct_add_section(NAME "list")
function("${list}")
ct_add_section(NAME [[list]])
function("${CMAKETEST_SECTION}")
set(a_list 1 2 3)
ct_add_section(NAME "is_in_list")
function("${is_in_list}")
ct_add_section(NAME [[is_in_list]])
function("${CMAKETEST_SECTION}")
cpp_contains(result 1 "${a_list}")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "is_not_in_list")
function("${is_not_in_list}")
ct_add_section(NAME [[is_not_in_list]])
function("${CMAKETEST_SECTION}")
cpp_contains(result 42 "${a_list}")
ct_assert_equal(result FALSE)
endfunction()
endfunction()

ct_add_section(NAME "map")
function("${map}")
ct_add_section(NAME [[map]])
function("${CMAKETEST_SECTION}")
include(cmakepp_lang/map/map)

cpp_map(CTOR a_map a_key a_value foo bar)

ct_add_section(NAME "has_key")
function("${has_key}")
ct_add_section(NAME [[has_key]])
function("${CMAKETEST_SECTION}")
cpp_contains(result "foo" "${a_map}")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "does_not_have_key")
function("${does_not_have_key}")
ct_add_section(NAME [[does_not_have_key]])
function("${CMAKETEST_SECTION}")
cpp_contains(result "bar" "${a_map}")
ct_assert_equal(result FALSE)
endfunction()
endfunction()

ct_add_section(NAME "string")
function("${string}")
ct_add_section(NAME "is_in_string")
function("${is_in_string}")
ct_add_section(NAME [[string]])
function("${CMAKETEST_SECTION}")
ct_add_section(NAME [[is_in_string]])
function("${CMAKETEST_SECTION}")
cpp_contains(result "world" "Hello world")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "is_not_in_string")
function("${is_not_in_string}")
ct_add_section(NAME [[is_not_in_string]])
function("${CMAKETEST_SECTION}")
cpp_contains(result "goodbye" "Hello world")
ct_assert_equal(result FALSE)
endfunction()
Expand Down
42 changes: 21 additions & 21 deletions tests/algorithm/copy.cmake
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
include(cmake_test/cmake_test)

ct_add_test(NAME "cpp_copy")
function("${cpp_copy}")
ct_add_test(NAME [[cpp_copy]])
function("${CMAKETEST_TEST}")
include(cmakepp_lang/algorithm/copy)
include(cmakepp_lang/algorithm/equal)

# ct_add_section(NAME "Signature")
# ct_add_section(NAME [[Signature]])
# set(CMAKEPP_LANG_DEBUG_MODE ON)
#
# ct_add_section(NAME "0th argument is desc")
# ct_add_section(NAME [[0th argument is desc]])
# cpp_copy(TRUE hi)
# ct_assert_fails_as("Assertion: bool is convertible to desc failed.")
# endfunction()
#
# ct_add_section(NAME "Takes exactly 2 arguments.")
# ct_add_section(NAME [[Takes exactly 2 arguments.]])
# cpp_copy(result foo bar)
# ct_assert_fails_as("Function takes 2 argument(s), but 3 was/were")
# endfunction()
# endfunction()

ct_add_section(NAME "bool")
function("${bool}")
ct_add_section(NAME [[bool]])
function("${CMAKETEST_SECTION}")
set(lhs TRUE)
cpp_copy(rhs "${lhs}")
cpp_equal(result "${lhs}" "${rhs}")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "descriptions")
function("${descriptions}")
ct_add_section(NAME [[descriptions]])
function("${CMAKETEST_SECTION}")
set(lhs "hello world")
cpp_copy(rhs "${lhs}")
cpp_equal(result "${lhs}" "${rhs}")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "floats")
function("${floats}")
ct_add_section(NAME [[floats]])
function("${CMAKETEST_SECTION}")
set(lhs 3.14)
cpp_copy(rhs "${lhs}")
cpp_equal(result "${lhs}" "${rhs}")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "ints")
function("${ints}")
ct_add_section(NAME [[ints]])
function("${CMAKETEST_SECTION}")
set(lhs 42)
cpp_copy(rhs "${lhs}")
cpp_equal(result "${lhs}" "${rhs}")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "lists")
function("${lists}")
ct_add_section(NAME [[lists]])
function("${CMAKETEST_SECTION}")
set(lhs hello world)
cpp_copy(rhs "${lhs}")
cpp_equal(result "${lhs}" "${rhs}")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "map")
function("${map}")
ct_add_section(NAME [[map]])
function("${CMAKETEST_SECTION}")
include(cmakepp_lang/map/map)
cpp_map(CTOR lhs a_key a_value foo bar)
cpp_copy(rhs "${lhs}")
cpp_equal(result "${lhs}" "${rhs}")
ct_assert_equal(result TRUE)
endfunction()

ct_add_section(NAME "objects")
function("${objects}")
ct_add_section(NAME [[objects]])
function("${CMAKETEST_SECTION}")
include(cmakepp_lang/object/object)

cpp_copy(rhs "${__CMAKEPP_LANG_OBJECT_SINGLETON__}")
Expand All @@ -78,8 +78,8 @@ function("${cpp_copy}")
ct_assert_not_equal(__CMAKEPP_LANG_OBJECT_SINGLETON__ "${rhs}")
endfunction()

ct_add_section(NAME "types")
function("${types}")
ct_add_section(NAME [[types]])
function("${CMAKETEST_SECTION}")
set(lhs int)
cpp_copy(rhs "${lhs}")
cpp_equal(result "${lhs}" "${rhs}")
Expand Down
Loading

0 comments on commit 789faf6

Please sign in to comment.