020-TestCase-1.cpp 1.0 KB

1234567891011121314151617181920212223242526272829
  1. // 020-TestCase-1.cpp
  2. #include <catch2/catch_test_macros.hpp>
  3. TEST_CASE( "1: All test cases reside in other .cpp files (empty)", "[multi-file:1]" ) {
  4. }
  5. // ^^^
  6. // Normally no TEST_CASEs in this file.
  7. // Here just to show there are two source files via option --list-tests.
  8. // Compile & run:
  9. // - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 020-TestCase-1.cpp
  10. // - g++ -std=c++14 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 020-TestCase TestCase-1.o 020-TestCase-2.cpp && 020-TestCase --success
  11. //
  12. // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 020-TestCase-1.cpp
  13. // - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -Fe020-TestCase.exe 020-TestCase-1.obj 020-TestCase-2.cpp && 020-TestCase --success
  14. // Expected test case listing:
  15. //
  16. // prompt> 020-TestCase --list-tests *
  17. // Matching test cases:
  18. // 1: All test cases reside in other .cpp files (empty)
  19. // [multi-file:1]
  20. // 2: Factorial of 0 is computed (fail)
  21. // [multi-file:2]
  22. // 2: Factorials of 1 and higher are computed (pass)
  23. // [multi-file:2]
  24. // 3 matching test cases