X05-DeferredStaticChecks.cpp 571 B

123456789101112131415161718192021
  1. // Copyright Catch2 Authors
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // https://www.boost.org/LICENSE_1_0.txt)
  5. // SPDX-License-Identifier: BSL-1.0
  6. /**\file
  7. * Checks that when `STATIC_CHECK` is deferred to runtime and fails, it
  8. * does not abort the test case.
  9. */
  10. #include <catch2/catch_test_macros.hpp>
  11. TEST_CASE("Deferred static checks") {
  12. STATIC_CHECK(1 == 2);
  13. STATIC_CHECK_FALSE(1 != 2);
  14. // This last assertion must be executed too
  15. CHECK(1 == 2);
  16. }