14#include <gtest/gtest.h>
33 bool catch_exception =
true;
35 bool catch_exception =
false;
38 const char* keatest_catch_exception = getenv(
"KEATEST_CATCH_EXCEPTION");
39 if (keatest_catch_exception != NULL) {
40 if (strcmp(keatest_catch_exception,
"1") == 0) {
41 catch_exception =
true;
42 }
else if (strcmp(keatest_catch_exception,
"0") == 0) {
43 catch_exception =
false;
45 std::cerr <<
"***ERROR: KEATEST_CATCH_EXCEPTION is '"
46 << keatest_catch_exception
47 <<
"': allowed values are '1' or '0'.\n"
48 <<
" The default value of "
50 "1 (exception catching enabled)":
51 "0 (exception catching disabled)")
52 <<
" will be used.\n";
57 if (catch_exception) {
59 ret = RUN_ALL_TESTS();
64 std::cerr <<
"*** Exception derived from isc::exception thrown:\n"
65 <<
" file: " << ex.
getFile() <<
"\n"
66 <<
" line: " << ex.
getLine() <<
"\n"
67 <<
" what: " << ex.
what() << std::endl;
69 }
catch (
const std::exception& ex) {
70 std::cerr <<
"*** Exception derived from std::exception thrown:\n"
71 <<
" what: " << ex.
what() << std::endl;
81 ret = RUN_ALL_TESTS();
This is a base class for exceptions thrown from the DNS library module.
const char * getFile() const
Gets the file name where the exception was thrown.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
size_t getLine() const
Gets the line number of the file where the exception was thrown.
int run_all()
Run All Tests.
Defines the logger used by the top-level component of kea-lfc.