From 26f6012bb92f012d972efe6ab6ecda6f8c8191b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 12 Feb 2017 14:47:25 +0100 Subject: [PATCH] Expanded the practical example in slow-compiles documentation --- docs/slow-compiles.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/slow-compiles.md b/docs/slow-compiles.md index efb3d6b5..1217f9f8 100644 --- a/docs/slow-compiles.md +++ b/docs/slow-compiles.md @@ -42,6 +42,21 @@ TEST_CASE( "Factorials are computed", "[factorial]" ) { After compiling `tests-main.cpp` once, it is enough to link it with separately compiled `tests-factorial.cpp`. This means that adding more tests to `tests-factorial.cpp`, will not result in recompiling Catch's main and the resulting compilation times will decrease substantially. +``` +$ g++ tests-main.cpp -c +$ g++ tests-main.o tests-factorial.cpp -o tests && ./tests -r compact +Passed 1 test case with 4 assertions. +``` + +Now, the next time we change the file `tests-factorial.cpp` (say we add `REQUIRE( Factorial(0) == 1)`), it is enough to recompile the tests instead of recompiling main as well: + +``` +$ g++ tests-main.o tests-factorial.cpp -o tests +$ g++ tests-main.o tests-factorial.cpp -o tests && ./tests -r compact +tests-factorial.cpp:11: failed: Factorial(0) == 1 for: 0 == 1 +Failed 1 test case, failed 1 assertion. +``` + ---