From 1c65eb7c58d92f1df5e3b26a199bc0f678ed86dd Mon Sep 17 00:00:00 2001
From: Tim Kaune <tim.kaune@gmx.de>
Date: Mon, 29 Jan 2024 18:17:40 +0100
Subject: [PATCH] Add unit tests

---
 CMakeLists.txt                                |   9 ++
 tests/CMakeLists.txt                          |  85 +++++++++++++
 tests/common-failures_test-case-01.cmake      |  50 ++++++++
 tests/common-failures_test-case-02.cmake      |  50 ++++++++
 tests/helpers/assertions.cmake                | 116 ++++++++++++++++++
 tests/helpers/test_case_wrapper.cmake         |  34 +++++
 tests/helpers/testee_macro_wrapper.cmake      |  32 +++++
 ...equested-by-common-flag_test-case-01.cmake |  41 +++++++
 ...equested-by-common-flag_test-case-02.cmake |  41 +++++++
 ...equested-by-common-flag_test-case-03.cmake |  45 +++++++
 ...equested-by-common-flag_test-case-04.cmake |  44 +++++++
 ...equested-by-common-flag_test-case-05.cmake |  44 +++++++
 ...equested-by-common-flag_test-case-06.cmake |  47 +++++++
 ...equested-by-common-flag_test-case-07.cmake |  41 +++++++
 ...equested-by-common-flag_test-case-08.cmake |  41 +++++++
 ...equested-by-common-flag_test-case-09.cmake |  45 +++++++
 ...equested-by-common-flag_test-case-10.cmake |  44 +++++++
 ...equested-by-common-flag_test-case-11.cmake |  44 +++++++
 ...equested-by-common-flag_test-case-12.cmake |  47 +++++++
 ...-requested-by-component_test-case-01.cmake |  41 +++++++
 ...-requested-by-component_test-case-02.cmake |  46 +++++++
 ...-requested-by-component_test-case-03.cmake |  44 +++++++
 ...-requested-by-component_test-case-04.cmake |  49 ++++++++
 ...-requested-by-component_test-case-05.cmake |  41 +++++++
 ...-requested-by-component_test-case-06.cmake |  46 +++++++
 ...-requested-by-component_test-case-07.cmake |  44 +++++++
 ...-requested-by-component_test-case-08.cmake |  49 ++++++++
 ...quested-by-package-flag_test-case-01.cmake |  41 +++++++
 ...quested-by-package-flag_test-case-02.cmake |  46 +++++++
 ...quested-by-package-flag_test-case-03.cmake |  44 +++++++
 ...quested-by-package-flag_test-case-04.cmake |  49 ++++++++
 ...quested-by-package-flag_test-case-05.cmake |  41 +++++++
 ...quested-by-package-flag_test-case-06.cmake |  46 +++++++
 ...quested-by-package-flag_test-case-07.cmake |  44 +++++++
 ...quested-by-package-flag_test-case-08.cmake |  49 ++++++++
 tests/mocks/failure-target1.cmake             |   2 +
 tests/mocks/failure-target2.cmake             |   2 +
 tests/mocks/success-target1.cmake             |   2 +
 tests/mocks/success-target2.cmake             |   2 +
 39 files changed, 1628 insertions(+)
 create mode 100644 tests/CMakeLists.txt
 create mode 100644 tests/common-failures_test-case-01.cmake
 create mode 100644 tests/common-failures_test-case-02.cmake
 create mode 100644 tests/helpers/assertions.cmake
 create mode 100644 tests/helpers/test_case_wrapper.cmake
 create mode 100644 tests/helpers/testee_macro_wrapper.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-01.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-02.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-03.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-04.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-05.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-06.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-07.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-08.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-09.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-10.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-11.cmake
 create mode 100644 tests/include-requested-by-common-flag_test-case-12.cmake
 create mode 100644 tests/include-requested-by-component_test-case-01.cmake
 create mode 100644 tests/include-requested-by-component_test-case-02.cmake
 create mode 100644 tests/include-requested-by-component_test-case-03.cmake
 create mode 100644 tests/include-requested-by-component_test-case-04.cmake
 create mode 100644 tests/include-requested-by-component_test-case-05.cmake
 create mode 100644 tests/include-requested-by-component_test-case-06.cmake
 create mode 100644 tests/include-requested-by-component_test-case-07.cmake
 create mode 100644 tests/include-requested-by-component_test-case-08.cmake
 create mode 100644 tests/include-requested-by-package-flag_test-case-01.cmake
 create mode 100644 tests/include-requested-by-package-flag_test-case-02.cmake
 create mode 100644 tests/include-requested-by-package-flag_test-case-03.cmake
 create mode 100644 tests/include-requested-by-package-flag_test-case-04.cmake
 create mode 100644 tests/include-requested-by-package-flag_test-case-05.cmake
 create mode 100644 tests/include-requested-by-package-flag_test-case-06.cmake
 create mode 100644 tests/include-requested-by-package-flag_test-case-07.cmake
 create mode 100644 tests/include-requested-by-package-flag_test-case-08.cmake
 create mode 100644 tests/mocks/failure-target1.cmake
 create mode 100644 tests/mocks/failure-target2.cmake
 create mode 100644 tests/mocks/success-target1.cmake
 create mode 100644 tests/mocks/success-target2.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e60d81..b729fa0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,11 @@ include(GNUInstallDirs)
 
 string(COMPARE EQUAL "${CMAKE_PROJECT_NAME}" "${PROJECT_NAME}" IS_TOP_LEVEL)
 
+if (IS_TOP_LEVEL)
+    include(CTest)
+    set(CMAKE_CTEST_ARGUMENTS "--verbose")
+endif ()
+
 # LoadStaticSharedTargets is a CMake script, which we never want to debug
 # If using a multi config generator
 if (GENERATOR_IS_MULTI_CONFIG)
@@ -48,6 +53,10 @@ endif ()
 
 add_subdirectory(src)
 
+if (IS_TOP_LEVEL AND BUILD_TESTING)
+    add_subdirectory(tests)
+endif ()
+
 option(LoadStaticSharedTargets_INCLUDE_PACKAGING "Include packaging rules for LoadStaticSharedTargets" "${IS_TOP_LEVEL}")
 
 if (LoadStaticSharedTargets_INCLUDE_PACKAGING)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644
index 0000000..dee4f65
--- /dev/null
+++ b/tests/CMakeLists.txt
@@ -0,0 +1,85 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+set(
+    TEST_CASES
+    "common-failures_test-case-01"
+    "common-failures_test-case-02"
+    "include-requested-by-common-flag_test-case-01"
+    "include-requested-by-common-flag_test-case-04"
+    "include-requested-by-common-flag_test-case-07"
+    "include-requested-by-common-flag_test-case-10"
+    "include-requested-by-component_test-case-01"
+    "include-requested-by-component_test-case-02"
+    "include-requested-by-component_test-case-03"
+    "include-requested-by-component_test-case-04"
+    "include-requested-by-component_test-case-05"
+    "include-requested-by-component_test-case-06"
+    "include-requested-by-component_test-case-07"
+    "include-requested-by-component_test-case-08"
+    "include-requested-by-package-flag_test-case-01"
+    "include-requested-by-package-flag_test-case-02"
+    "include-requested-by-package-flag_test-case-03"
+    "include-requested-by-package-flag_test-case-04"
+    "include-requested-by-package-flag_test-case-05"
+    "include-requested-by-package-flag_test-case-06"
+    "include-requested-by-package-flag_test-case-07"
+    "include-requested-by-package-flag_test-case-08"
+)
+
+set(
+    TEST_CASES_WITH_WARNING
+    "include-requested-by-common-flag_test-case-02"
+    "include-requested-by-common-flag_test-case-03"
+    "include-requested-by-common-flag_test-case-05"
+    "include-requested-by-common-flag_test-case-06"
+    "include-requested-by-common-flag_test-case-08"
+    "include-requested-by-common-flag_test-case-09"
+    "include-requested-by-common-flag_test-case-11"
+    "include-requested-by-common-flag_test-case-12"
+)
+
+foreach (TEST_CASE IN LISTS TEST_CASES TEST_CASES_WITH_WARNING)
+    add_test(
+        NAME "${TEST_CASE}"
+        COMMAND "${CMAKE_COMMAND}" -D CMAKE_MINIMUM_REQUIRED_VERSION=${CMAKE_MINIMUM_REQUIRED_VERSION} -D "TEST_CASE=${TEST_CASE}" -P "./helpers/test_case_wrapper.cmake"
+        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+    )
+endforeach ()
+
+foreach (TEST_CASE IN LISTS TEST_CASES_WITH_WARNING)
+    add_test(
+        NAME "${TEST_CASE}_check-warning"
+        COMMAND "${CMAKE_COMMAND}" -D CMAKE_MINIMUM_REQUIRED_VERSION=${CMAKE_MINIMUM_REQUIRED_VERSION} -D "TEST_CASE=${TEST_CASE}" -P "./helpers/test_case_wrapper.cmake"
+        WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+    )
+
+    set_tests_properties(
+        "${TEST_CASE}_check-warning"
+        PROPERTIES
+        PASS_REGULAR_EXPRESSION
+        "Requested `.+` targets for package .+ were not found\\.;Trying alternative `.+` targets\\."
+    )
+endforeach ()
diff --git a/tests/common-failures_test-case-01.cmake b/tests/common-failures_test-case-01.cmake
new file mode 100644
index 0000000..57e5f64
--- /dev/null
+++ b/tests/common-failures_test-case-01.cmake
@@ -0,0 +1,50 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+
+
+TEST_CASE("Fail, if unknown find component is being used: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "unknown")
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} does not recognize component `unknown`."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
+REQUIRE_UNDEFINED(TEST_TARGET_2)
diff --git a/tests/common-failures_test-case-02.cmake b/tests/common-failures_test-case-02.cmake
new file mode 100644
index 0000000..b94ba34
--- /dev/null
+++ b/tests/common-failures_test-case-02.cmake
@@ -0,0 +1,50 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+
+
+TEST_CASE("Fail, if both `shared` and `static` find components are being used together: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "shared" "static")
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `static` and `shared` components are mutually exclusive."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
+REQUIRE_UNDEFINED(TEST_TARGET_2)
diff --git a/tests/helpers/assertions.cmake b/tests/helpers/assertions.cmake
new file mode 100644
index 0000000..42fdb29
--- /dev/null
+++ b/tests/helpers/assertions.cmake
@@ -0,0 +1,116 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+macro(TEST_CASE DESCRIPTION)
+    message(NOTICE "${DESCRIPTION}")
+endmacro()
+
+macro(REQUIRE_FALSY VAR_NAME)
+    if (NOT DEFINED ${VAR_NAME})
+        message(FATAL_ERROR "${VAR_NAME} is NOT DEFINED!")
+    elseif (${VAR_NAME})
+        message(FATAL_ERROR "${VAR_NAME} is TRUTHY!")
+    else ()
+        message(STATUS "${VAR_NAME} is DEFINED and FALSY.")
+    endif ()
+endmacro()
+
+macro(CHECK_FALSY VAR_NAME)
+    if (NOT DEFINED ${VAR_NAME})
+        message(SEND_ERROR "${VAR_NAME} is NOT DEFINED!")
+    elseif (${VAR_NAME})
+        message(SEND_ERROR "${VAR_NAME} is TRUTHY!")
+    else ()
+        message(STATUS "${VAR_NAME} is DEFINED and FALSY.")
+    endif ()
+endmacro()
+
+macro(REQUIRE_TRUTHY VAR_NAME)
+    if (NOT DEFINED ${VAR_NAME})
+        message(FATAL_ERROR "${VAR_NAME} is NOT DEFINED!")
+    elseif (NOT ${VAR_NAME})
+        message(FATAL_ERROR "${VAR_NAME} is FALSY!")
+    else ()
+        message(STATUS "${VAR_NAME} is DEFINED and TRUTHY.")
+    endif ()
+endmacro()
+
+macro(CHECK_TRUTHY VAR_NAME)
+    if (NOT DEFINED ${VAR_NAME})
+        message(SEND_ERROR "${VAR_NAME} is NOT DEFINED!")
+    elseif (NOT ${VAR_NAME})
+        message(SEND_ERROR "${VAR_NAME} is FALSY!")
+    else ()
+        message(STATUS "${VAR_NAME} is DEFINED and TRUTHY.")
+    endif ()
+endmacro()
+
+macro(REQUIRE_UNDEFINED VAR_NAME)
+    if (DEFINED ${VAR_NAME})
+        message(FATAL_ERROR "${VAR_NAME} is DEFINED!")
+    else ()
+        message(STATUS "${VAR_NAME} is NOT DEFINED.")
+    endif ()
+endmacro()
+
+macro(CHECK_UNDEFINED VAR_NAME)
+    if (DEFINED ${VAR_NAME})
+        message(SEND_ERROR "${VAR_NAME} is DEFINED!")
+    else ()
+        message(STATUS "${VAR_NAME} is NOT DEFINED.")
+    endif ()
+endmacro()
+
+macro(REQUIRE_DEFINED VAR_NAME)
+    if (NOT DEFINED ${VAR_NAME})
+        message(FATAL_ERROR "${VAR_NAME} is NOT DEFINED!")
+    else ()
+        message(STATUS "${VAR_NAME} is DEFINED.")
+    endif ()
+endmacro()
+
+macro(CHECK_DEFINED VAR_NAME)
+    if (NOT DEFINED ${VAR_NAME})
+        message(SEND_ERROR "${VAR_NAME} is NOT DEFINED!")
+    else ()
+        message(STATUS "${VAR_NAME} is DEFINED.")
+    endif ()
+endmacro()
+
+macro(REQUIRE_STREQUAL VAR_NAME VALUE)
+    if (NOT ${VAR_NAME} STREQUAL "${VALUE}")
+        message(FATAL_ERROR "${VAR_NAME} with value `${${VAR_NAME}}` is NOT STREQUAL to `${VALUE}`!")
+    else ()
+        message(STATUS "${VAR_NAME} is STREQUAL to `${VALUE}`.")
+    endif ()
+endmacro()
+
+macro(CHECK_STREQUAL VAR_NAME VALUE)
+    if (NOT ${VAR_NAME} STREQUAL "${VALUE}")
+        message(SEND_ERROR "${VAR_NAME} with value `${${VAR_NAME}}` is NOT STREQUAL to `${VALUE}`!")
+    else ()
+        message(STATUS "${VAR_NAME} is STREQUAL to `${VALUE}`.")
+    endif ()
+endmacro()
diff --git a/tests/helpers/test_case_wrapper.cmake b/tests/helpers/test_case_wrapper.cmake
new file mode 100644
index 0000000..744a3e0
--- /dev/null
+++ b/tests/helpers/test_case_wrapper.cmake
@@ -0,0 +1,34 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+cmake_policy(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
+
+include("./helpers/assertions.cmake")
+include("../src/cmake/LoadStaticSharedTargets.cmake")
+
+# find_package() mock
+set(CMAKE_FIND_PACKAGE_NAME "test")
+
+include("./${TEST_CASE}.cmake")
diff --git a/tests/helpers/testee_macro_wrapper.cmake b/tests/helpers/testee_macro_wrapper.cmake
new file mode 100644
index 0000000..6b699ad
--- /dev/null
+++ b/tests/helpers/testee_macro_wrapper.cmake
@@ -0,0 +1,32 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+# This wrapper is necessary to capture return() commands in the macro
+load_static_shared_targets(
+    STATIC_TARGETS
+    ${STATIC_TEST_TARGET_FILES}
+    SHARED_TARGETS
+    ${SHARED_TEST_TARGET_FILES}
+)
diff --git a/tests/include-requested-by-common-flag_test-case-01.cmake b/tests/include-requested-by-common-flag_test-case-01.cmake
new file mode 100644
index 0000000..4041d69
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-01.cmake
@@ -0,0 +1,41 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one shared target by common flag (`BUILD_SHARED_LIBS`): ")
+
+set(BUILD_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
diff --git a/tests/include-requested-by-common-flag_test-case-02.cmake b/tests/include-requested-by-common-flag_test-case-02.cmake
new file mode 100644
index 0000000..fc29210
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-02.cmake
@@ -0,0 +1,41 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one shared target by common flag, but it doesn't exist. Include static target instead: ")
+
+set(BUILD_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
diff --git a/tests/include-requested-by-common-flag_test-case-03.cmake b/tests/include-requested-by-common-flag_test-case-03.cmake
new file mode 100644
index 0000000..3313f0f
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-03.cmake
@@ -0,0 +1,45 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one shared target by common flag, but neither the shared nor the static target exist: ")
+
+set(BUILD_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `STATIC` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
diff --git a/tests/include-requested-by-common-flag_test-case-04.cmake b/tests/include-requested-by-common-flag_test-case-04.cmake
new file mode 100644
index 0000000..e6d5de0
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-04.cmake
@@ -0,0 +1,44 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple shared targets by common flag (`BUILD_SHARED_LIBS`): ")
+
+set(BUILD_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+    "./mocks/success-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
+REQUIRE_TRUTHY(TEST_TARGET_2)
diff --git a/tests/include-requested-by-common-flag_test-case-05.cmake b/tests/include-requested-by-common-flag_test-case-05.cmake
new file mode 100644
index 0000000..51bb9c2
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-05.cmake
@@ -0,0 +1,44 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple shared targets by common flag, but one doesn't exist. Include static targets instead: ")
+
+set(BUILD_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+    "./mocks/success-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
+REQUIRE_TRUTHY(TEST_TARGET_2)
diff --git a/tests/include-requested-by-common-flag_test-case-06.cmake b/tests/include-requested-by-common-flag_test-case-06.cmake
new file mode 100644
index 0000000..9b9517b
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-06.cmake
@@ -0,0 +1,47 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple shared targets by common flag, but neither the shared nor the static targets exist: ")
+
+set(BUILD_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `STATIC` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
diff --git a/tests/include-requested-by-common-flag_test-case-07.cmake b/tests/include-requested-by-common-flag_test-case-07.cmake
new file mode 100644
index 0000000..fe237c3
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-07.cmake
@@ -0,0 +1,41 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one static target by common flag (`BUILD_SHARED_LIBS`): ")
+
+set(BUILD_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
diff --git a/tests/include-requested-by-common-flag_test-case-08.cmake b/tests/include-requested-by-common-flag_test-case-08.cmake
new file mode 100644
index 0000000..480db26
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-08.cmake
@@ -0,0 +1,41 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one static target by common flag, but it doesn't exist. Include shared target instead: ")
+
+set(BUILD_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
diff --git a/tests/include-requested-by-common-flag_test-case-09.cmake b/tests/include-requested-by-common-flag_test-case-09.cmake
new file mode 100644
index 0000000..286ce23
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-09.cmake
@@ -0,0 +1,45 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one static target by common flag, but neither the static nor the shared target exist: ")
+
+set(BUILD_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `SHARED` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
diff --git a/tests/include-requested-by-common-flag_test-case-10.cmake b/tests/include-requested-by-common-flag_test-case-10.cmake
new file mode 100644
index 0000000..3f86dc6
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-10.cmake
@@ -0,0 +1,44 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple static targets by common flag (`BUILD_SHARED_LIBS`): ")
+
+set(BUILD_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+    "./mocks/success-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
+REQUIRE_TRUTHY(TEST_TARGET_2)
diff --git a/tests/include-requested-by-common-flag_test-case-11.cmake b/tests/include-requested-by-common-flag_test-case-11.cmake
new file mode 100644
index 0000000..f9a8082
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-11.cmake
@@ -0,0 +1,44 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple static targets by common flag, but one doesn't exist. Include shared targets instead: ")
+
+set(BUILD_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+    "./mocks/success-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
+REQUIRE_TRUTHY(TEST_TARGET_2)
diff --git a/tests/include-requested-by-common-flag_test-case-12.cmake b/tests/include-requested-by-common-flag_test-case-12.cmake
new file mode 100644
index 0000000..219e93d
--- /dev/null
+++ b/tests/include-requested-by-common-flag_test-case-12.cmake
@@ -0,0 +1,47 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple static targets by common flag, but neither the static nor the shared targets exist: ")
+
+set(BUILD_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `SHARED` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
diff --git a/tests/include-requested-by-component_test-case-01.cmake b/tests/include-requested-by-component_test-case-01.cmake
new file mode 100644
index 0000000..9116f45
--- /dev/null
+++ b/tests/include-requested-by-component_test-case-01.cmake
@@ -0,0 +1,41 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one shared target by find component: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "shared")
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
diff --git a/tests/include-requested-by-component_test-case-02.cmake b/tests/include-requested-by-component_test-case-02.cmake
new file mode 100644
index 0000000..2ca2f9f
--- /dev/null
+++ b/tests/include-requested-by-component_test-case-02.cmake
@@ -0,0 +1,46 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one shared target by find component, but it doesn't exist: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "shared")
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `SHARED` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
diff --git a/tests/include-requested-by-component_test-case-03.cmake b/tests/include-requested-by-component_test-case-03.cmake
new file mode 100644
index 0000000..98a460a
--- /dev/null
+++ b/tests/include-requested-by-component_test-case-03.cmake
@@ -0,0 +1,44 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple shared targets by find component: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "shared")
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+    "./mocks/success-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
+REQUIRE_TRUTHY(TEST_TARGET_2)
diff --git a/tests/include-requested-by-component_test-case-04.cmake b/tests/include-requested-by-component_test-case-04.cmake
new file mode 100644
index 0000000..8f53a6e
--- /dev/null
+++ b/tests/include-requested-by-component_test-case-04.cmake
@@ -0,0 +1,49 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple shared targets by find component, but one doesn't exist: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "shared")
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `SHARED` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
+REQUIRE_UNDEFINED(TEST_TARGET_2)
diff --git a/tests/include-requested-by-component_test-case-05.cmake b/tests/include-requested-by-component_test-case-05.cmake
new file mode 100644
index 0000000..366209b
--- /dev/null
+++ b/tests/include-requested-by-component_test-case-05.cmake
@@ -0,0 +1,41 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one static target by find component: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "static")
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
diff --git a/tests/include-requested-by-component_test-case-06.cmake b/tests/include-requested-by-component_test-case-06.cmake
new file mode 100644
index 0000000..3ca2796
--- /dev/null
+++ b/tests/include-requested-by-component_test-case-06.cmake
@@ -0,0 +1,46 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one static target by find component, but it doesn't exist: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "static")
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `STATIC` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
diff --git a/tests/include-requested-by-component_test-case-07.cmake b/tests/include-requested-by-component_test-case-07.cmake
new file mode 100644
index 0000000..edf29dd
--- /dev/null
+++ b/tests/include-requested-by-component_test-case-07.cmake
@@ -0,0 +1,44 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple static targets by find component: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "static")
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+    "./mocks/success-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
+REQUIRE_TRUTHY(TEST_TARGET_2)
diff --git a/tests/include-requested-by-component_test-case-08.cmake b/tests/include-requested-by-component_test-case-08.cmake
new file mode 100644
index 0000000..e8e2c08
--- /dev/null
+++ b/tests/include-requested-by-component_test-case-08.cmake
@@ -0,0 +1,49 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple static targets by find component, but one doesn't exist: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS "static")
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `STATIC` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
+REQUIRE_UNDEFINED(TEST_TARGET_2)
diff --git a/tests/include-requested-by-package-flag_test-case-01.cmake b/tests/include-requested-by-package-flag_test-case-01.cmake
new file mode 100644
index 0000000..ab6a593
--- /dev/null
+++ b/tests/include-requested-by-package-flag_test-case-01.cmake
@@ -0,0 +1,41 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one shared target by package specific flag (`${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS`): ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
diff --git a/tests/include-requested-by-package-flag_test-case-02.cmake b/tests/include-requested-by-package-flag_test-case-02.cmake
new file mode 100644
index 0000000..3a88c47
--- /dev/null
+++ b/tests/include-requested-by-package-flag_test-case-02.cmake
@@ -0,0 +1,46 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one shared target by package specific flag, but it doesn't exist: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `SHARED` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
diff --git a/tests/include-requested-by-package-flag_test-case-03.cmake b/tests/include-requested-by-package-flag_test-case-03.cmake
new file mode 100644
index 0000000..9a5f21e
--- /dev/null
+++ b/tests/include-requested-by-package-flag_test-case-03.cmake
@@ -0,0 +1,44 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple shared targets by package specific flag (`${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS`): ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+    "./mocks/success-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
+REQUIRE_TRUTHY(TEST_TARGET_2)
diff --git a/tests/include-requested-by-package-flag_test-case-04.cmake b/tests/include-requested-by-package-flag_test-case-04.cmake
new file mode 100644
index 0000000..bcdf0ae
--- /dev/null
+++ b/tests/include-requested-by-package-flag_test-case-04.cmake
@@ -0,0 +1,49 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple shared targets by package specific flag, but one doesn't exist: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS TRUE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `SHARED` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
+REQUIRE_UNDEFINED(TEST_TARGET_2)
diff --git a/tests/include-requested-by-package-flag_test-case-05.cmake b/tests/include-requested-by-package-flag_test-case-05.cmake
new file mode 100644
index 0000000..a090d92
--- /dev/null
+++ b/tests/include-requested-by-package-flag_test-case-05.cmake
@@ -0,0 +1,41 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one static target by package specific flag (`${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS`): ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
diff --git a/tests/include-requested-by-package-flag_test-case-06.cmake b/tests/include-requested-by-package-flag_test-case-06.cmake
new file mode 100644
index 0000000..4f6edcb
--- /dev/null
+++ b/tests/include-requested-by-package-flag_test-case-06.cmake
@@ -0,0 +1,46 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include one static target by package specific flag, but it doesn't exist: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `STATIC` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
diff --git a/tests/include-requested-by-package-flag_test-case-07.cmake b/tests/include-requested-by-package-flag_test-case-07.cmake
new file mode 100644
index 0000000..299fcf6
--- /dev/null
+++ b/tests/include-requested-by-package-flag_test-case-07.cmake
@@ -0,0 +1,44 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple static targets by package specific flag (`${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS`): ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/success-target1.cmake"
+    "./mocks/success-target2.cmake"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+REQUIRE_TRUTHY(TEST_TARGET_1)
+REQUIRE_TRUTHY(TEST_TARGET_2)
diff --git a/tests/include-requested-by-package-flag_test-case-08.cmake b/tests/include-requested-by-package-flag_test-case-08.cmake
new file mode 100644
index 0000000..58cd886
--- /dev/null
+++ b/tests/include-requested-by-package-flag_test-case-08.cmake
@@ -0,0 +1,49 @@
+#[[
+MIT License
+
+CMake build script for LoadStaticSharedTargets module
+Copyright (c) 2024 Tim Kaune
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+]]
+
+TEST_CASE("Include multiple static targets by package specific flag, but one doesn't exist: ")
+
+set(${CMAKE_FIND_PACKAGE_NAME}_SHARED_LIBS FALSE)
+
+set(
+    STATIC_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/i-do-not-exist"
+)
+set(
+    SHARED_TEST_TARGET_FILES
+    "./mocks/failure-target1.cmake"
+    "./mocks/failure-target2.cmake"
+)
+
+include("./helpers/testee_macro_wrapper.cmake")
+
+CHECK_STREQUAL(
+    ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
+    "${CMAKE_FIND_PACKAGE_NAME} `STATIC` libraries were requested but not found."
+)
+REQUIRE_FALSY(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
+REQUIRE_UNDEFINED(TEST_TARGET_1)
+REQUIRE_UNDEFINED(TEST_TARGET_2)
diff --git a/tests/mocks/failure-target1.cmake b/tests/mocks/failure-target1.cmake
new file mode 100644
index 0000000..28063d6
--- /dev/null
+++ b/tests/mocks/failure-target1.cmake
@@ -0,0 +1,2 @@
+message(STATUS "Wrong target included.")
+set(TEST_TARGET_1 FALSE)
diff --git a/tests/mocks/failure-target2.cmake b/tests/mocks/failure-target2.cmake
new file mode 100644
index 0000000..e8c271e
--- /dev/null
+++ b/tests/mocks/failure-target2.cmake
@@ -0,0 +1,2 @@
+message(STATUS "Wrong target included.")
+set(TEST_TARGET_2 FALSE)
diff --git a/tests/mocks/success-target1.cmake b/tests/mocks/success-target1.cmake
new file mode 100644
index 0000000..8de8ffb
--- /dev/null
+++ b/tests/mocks/success-target1.cmake
@@ -0,0 +1,2 @@
+message(STATUS "Correct target successfully included.")
+set(TEST_TARGET_1 TRUE)
diff --git a/tests/mocks/success-target2.cmake b/tests/mocks/success-target2.cmake
new file mode 100644
index 0000000..dbbe242
--- /dev/null
+++ b/tests/mocks/success-target2.cmake
@@ -0,0 +1,2 @@
+message(STATUS "Correct target successfully included.")
+set(TEST_TARGET_2 TRUE)
-- 
GitLab