@lastchance, I've played around a bit with the example code samples included with the library. It makes the output look more colorful, literally, as well as violating more than a handful of C++ standards practices.
FYI, I installed the library yesterday, had never even heard of it before then.
#define CATCH_CONFIG_MAIN
tells the framework to generate a main function.
Defining that macro AND having a regular main function causes linker problems. Visual Studio 2022 doesn't like the above code.
LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
|
So the VS linker is given a choice of TWO mains and ends-up default using the normal C++ main instead of the framework's main. All that
purty unit-testing gobbledygook script is then ignored and might as well not be left in the code.
The library code examples, all of them, NEVER have a regularly defined main. main is smushed into the code by the framework.
I figured this out just by compiling the code, reading the compiler/linker output, as well as bothering to read the library's documentation and scanning the examples.
So where is
#include <iostream>
? Buried deep in that catch.hpp header that also includes a handful of other C/C++ headers.
Easy to find by searching the header. If one bothers to be pro-active enough to actually look.
To be honest, from what I've seen by poking and mucking around this unit-testing library looks less like C++, it certainly isn't remotely standard C++, and more like a half-arsed scripting language framework leveraging C++ so it gets compiled.
The sole "advantage" is the testing works the same whether the code is compiled in either Debug and Release mode. Is that worth coding in IMO what is a VERY non-standard C++ manner?
Not for me. YMMV.