File tree Expand file tree Collapse file tree 5 files changed +20
-15
lines changed
Expand file tree Collapse file tree 5 files changed +20
-15
lines changed Original file line number Diff line number Diff line change 99
1010#include " cppbase/cppbaseAll.hpp"
1111
12- int main ( const int numberOfInputs, const char * inputArguments[ ] )
12+ int main (const int numberOfInputs, const char * inputArguments[] )
1313{
1414 const int factorial = cppbase::computeFactorial (10 );
1515 std::cout << " 10! = " << factorial << std::endl;
Original file line number Diff line number Diff line change 77#include < cstdlib>
88#include < iostream>
99
10- int main ( const int numberOfInputs, const char * inputArguments[ ] )
10+ int main (const int numberOfInputs, const char * inputArguments[ ])
1111{
1212 std::cout << " Hello World!" << std::endl;
1313 return EXIT_SUCCESS;
Original file line number Diff line number Diff line change 99# @TODO: add find_package call to use Catch2 that is already present and only fetch otherwise
1010# @TODO: consider only using the Catch2 single header to avoid building the whole library (slow)
1111
12- # Fetch Catch2 testing library
13- FetchContent_Declare(
14- Catch2
15- GIT_REPOSITORY https://github.com/catchorg/Catch2.git
16- GIT_TAG v3.0.1 # or a later release
17- )
18- FetchContent_MakeAvailable(Catch2)
12+ find_package (Catch2 3 REQUIRED)
13+ if (TARGET Catch2::Catch2)
14+ message (STATUS "Found Catch2" )
15+ else ()
16+ # Fetch Catch2 testing library
17+ FetchContent_Declare(
18+ Catch2
19+ GIT_REPOSITORY https://github.com/catchorg/Catch2.git
20+ GIT_TAG v3.0.1 # or a later release
21+ )
22+ FetchContent_MakeAvailable(Catch2)
23+ endif (TARGET Catch2::Catch2)
1924
2025# Add test executables and linked libraries
2126add_executable (cppbase_tests testFactorial.cpp)
Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ namespace cppbase
1313namespace tests
1414{
1515
16- TEST_CASE ( " Compute factorials" , " [factorial]" )
16+ TEST_CASE (" Compute factorials" , " [factorial]" )
1717{
18- REQUIRE ( computeFactorial (1 ) == 1 );
19- REQUIRE ( computeFactorial (2 ) == 2 );
20- REQUIRE ( computeFactorial (3 ) == 6 );
21- REQUIRE ( computeFactorial (10 ) == 3628800 );
18+ REQUIRE (computeFactorial (1 ) == 1 );
19+ REQUIRE (computeFactorial (2 ) == 2 );
20+ REQUIRE (computeFactorial (3 ) == 6 );
21+ REQUIRE (computeFactorial (10 ) == 3628800 );
2222}
2323
2424} // namespace tests
You can’t perform that action at this time.
0 commit comments