Archetype: cpp_component_test_main.cpp.mustache
Catch2 main with the project's logging/test-env setup.
See the Template variable reference for the complete list of available variables and their semantics.
Template
The full template source. Edit here and re-tangle with
compass build --direct tangle_codegen_templates to regenerate
library/templates/cpp_component_test_main.cpp.mustache.
{{! GENERATED FILE — tangled from projects/ores.codegen/library/templates/cpp_component.org. Edit the org source. }}
{{{cpp_license}}}
{{#component}}
#include <openssl/crypto.h>
#include <boost/scope_exit.hpp>
#include <catch2/catch_session.hpp>
#include <catch2/reporters/catch_reporter_registrars.hpp>
#include "ores.testing/logging_listener.hpp"
#include "ores.testing/database_lifecycle_listener.hpp"
CATCH_REGISTER_LISTENER(ores::testing::logging_listener)
CATCH_REGISTER_LISTENER(ores::testing::database_lifecycle_listener)
int main(int argc, char* argv[]) {
BOOST_SCOPE_EXIT(void) {
OPENSSL_cleanup();
} BOOST_SCOPE_EXIT_END
ores::testing::logging_listener::set_test_module_name("{{full_name}}.tests");
return Catch::Session().run(argc, argv);
}
{{/component}}
See also
- Parent facet: C++ component templates
- Template variable reference