updated test output
This commit is contained in:
parent
8f722d6908
commit
690aa93af9
|
|
@ -72,36 +72,31 @@ class test_suite {
|
||||||
|
|
||||||
auto test_arr = expand_test_tuple(_tests, std::make_index_sequence<TEST_NR>());
|
auto test_arr = expand_test_tuple(_tests, std::make_index_sequence<TEST_NR>());
|
||||||
|
|
||||||
std::cout << test_arr.size() << "\n";
|
|
||||||
|
|
||||||
std::cout << "--------------\n";
|
std::cout << "--------------\n";
|
||||||
|
|
||||||
for (auto [i, test_ref] : std::ranges::views::enumerate(test_arr)) {
|
for (auto [i, test_ref] : std::ranges::views::enumerate(test_arr)) {
|
||||||
const auto& test = test_ref.get();
|
const auto& test = test_ref.get();
|
||||||
|
|
||||||
std::cout << "Running Test: \"" << test.name() << "\"\n";
|
std::cout << "Running Test: \"" << test.name() << "\" "
|
||||||
|
"(Test " << i+1 << "/" << test_arr.size() << ")\n";
|
||||||
if (test.evalFlag() == EvalFlag::RUNTIME || test.evalFlag() == EvalFlag::RUNTIME_CONSTEVAL) {
|
if (test.evalFlag() == EvalFlag::RUNTIME || test.evalFlag() == EvalFlag::RUNTIME_CONSTEVAL) {
|
||||||
ret_val_s ret;
|
ret_val_s ret;
|
||||||
std::string ret_exc_str;
|
std::string ret_exc_str;
|
||||||
try {
|
try {
|
||||||
ret = test.evaluate();
|
ret = test.evaluate();
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
ret_exc_str = e.what();
|
ret_exc_str = std::string("Test failed with Exception: \"") + e.what() + "\"";
|
||||||
ret = ret_val_s(test.name(), ReturnCode::FAILED, ret_exc_str.c_str());
|
ret = ret_val_s(test.name(), ReturnCode::FAILED, ret_exc_str.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Result of Runtime Evaluation of Test \"" << ret.test_name << "\" (number: " << i
|
std::cout << "Result of Runtime Evaluation of Test \"" << ret.test_name << "\": " << ret.val << "\n"
|
||||||
<< "): "
|
<< "\t" << ret.msg << std::endl;
|
||||||
<< (ret.val == ReturnCode::PASSED ? "PASSED" : "FAILED") << "\n"
|
|
||||||
<< "\t" << ret.msg << "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test.evalFlag() == EvalFlag::CONSTEVAL || test.evalFlag() == EvalFlag::RUNTIME_CONSTEVAL) {
|
if (test.evalFlag() == EvalFlag::CONSTEVAL || test.evalFlag() == EvalFlag::RUNTIME_CONSTEVAL) {
|
||||||
const ret_val_s& ret = test.c_res();
|
const ret_val_s& ret = test.c_res();
|
||||||
std::cout << "Result of Consteval Evaluation of Test \"" << ret.test_name << "\" (number: " << i
|
std::cout << "Result of Consteval Evaluation of Test \"" << ret.test_name << "\": " << ret.val << "\n"
|
||||||
<< "): "
|
<< "\t" << ret.msg << std::endl;
|
||||||
<< (ret.val == ReturnCode::PASSED ? "PASSED" : "FAILED") << "\n"
|
|
||||||
<< "\t" << ret.msg << "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,15 @@ struct ret_val {
|
||||||
constexpr inline const ret_val_s& operator[](std::size_t i) const { return vals[i]; }
|
constexpr inline const ret_val_s& operator[](std::size_t i) const { return vals[i]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::ostream& operator<<(std::ostream& os, const ReturnCode &rc) {
|
||||||
|
switch (rc) {
|
||||||
|
case FAILED:
|
||||||
|
return os << "FAILED";
|
||||||
|
case PASSED:
|
||||||
|
return os << "PASSED";
|
||||||
|
default:
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif //CONST_CONTAINER_TEST_RETURN_VAL_H_
|
#endif //CONST_CONTAINER_TEST_RETURN_VAL_H_
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue