-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some basic tests to ament_cmake_libraries (#512)
Signed-off-by: Scott K Logan <[email protected]>
- Loading branch information
Showing
4 changed files
with
45 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
add_test(deduplicate "${CMAKE_COMMAND}" -P ${CMAKE_CURRENT_LIST_DIR}/test_deduplicate.cmake) |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
include("${CMAKE_CURRENT_LIST_DIR}/utilities.cmake") | ||
|
||
# Empty | ||
set(TEST_IN "") | ||
ament_libraries_deduplicate(ACTUAL ${TEST_IN}) | ||
assert_equal("" "${ACTUAL}") | ||
|
||
# Noop | ||
set(TEST_IN "foo;bar;baz") | ||
ament_libraries_deduplicate(ACTUAL ${TEST_IN}) | ||
assert_equal("foo;bar;baz" "${ACTUAL}") | ||
|
||
# Simple | ||
set(TEST_IN "foo;bar;baz;bar") | ||
ament_libraries_deduplicate(ACTUAL ${TEST_IN}) | ||
assert_equal("foo;baz;bar" "${ACTUAL}") | ||
|
||
# With matching build configs | ||
set(TEST_IN "debug;foo;debug;bar;debug;baz;debug;bar") | ||
ament_libraries_deduplicate(ACTUAL ${TEST_IN}) | ||
assert_equal("debug;foo;debug;baz;debug;bar" "${ACTUAL}") | ||
|
||
# With missing build configs | ||
set(TEST_IN "debug;foo;debug;bar;debug;baz;bar") | ||
ament_libraries_deduplicate(ACTUAL ${TEST_IN}) | ||
assert_equal("debug;foo;debug;bar;debug;baz;bar" "${ACTUAL}") | ||
|
||
# With mismatched build configs | ||
set(TEST_IN "debug;foo;debug;bar;debug;baz;release;bar") | ||
ament_libraries_deduplicate(ACTUAL ${TEST_IN}) | ||
assert_equal("debug;foo;debug;bar;debug;baz;release;bar" "${ACTUAL}") |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
set(ament_cmake_libraries_DIR "${CMAKE_CURRENT_LIST_DIR}/../cmake") | ||
include("${CMAKE_CURRENT_LIST_DIR}/../ament_cmake_libraries-extras.cmake") | ||
|
||
macro(assert_equal EXPECTED ACTUAL) | ||
if(NOT "${EXPECTED}" STREQUAL "${ACTUAL}") | ||
message(SEND_ERROR "Assert failed: Expected '${EXPECTED}', got '${ACTUAL}'") | ||
endif() | ||
endmacro() |