Remove the ill-conceived compilation perf tests using real tests

This commit is contained in:
Martin Hořeňovský
2021-06-20 16:25:57 +02:00
parent 849002aec0
commit bf61a418cb
19 changed files with 2228 additions and 2276 deletions

View File

@@ -20,55 +20,50 @@
#pragma clang diagnostic ignored "-Wunreachable-code"
#endif
namespace { namespace ExceptionTests {
namespace {
#ifndef EXCEPTION_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
#define EXCEPTION_TEST_HELPERS_INCLUDED
int thisThrows() {
throw std::domain_error( "expected exception" );
return 1;
}
int thisDoesntThrow() {
return 0;
}
class CustomException {
public:
explicit CustomException( const std::string& msg )
: m_msg( msg )
{}
std::string getMessage() const {
return m_msg;
int thisThrows() {
throw std::domain_error("expected exception");
return 1;
}
private:
std::string m_msg;
};
class CustomStdException : public std::exception {
public:
explicit CustomStdException( const std::string& msg )
: m_msg( msg )
{}
~CustomStdException() noexcept override {}
std::string getMessage() const {
return m_msg;
int thisDoesntThrow() {
return 0;
}
private:
std::string m_msg;
};
class CustomException {
public:
explicit CustomException(const std::string& msg)
: m_msg(msg) {}
std::string getMessage() const {
return m_msg;
}
private:
std::string m_msg;
};
class CustomStdException : public std::exception {
public:
explicit CustomStdException(const std::string& msg)
: m_msg(msg) {}
~CustomStdException() noexcept override {}
std::string getMessage() const {
return m_msg;
}
private:
std::string m_msg;
};
[[noreturn]] void throwCustom() {
throw CustomException("custom exception - not std");
}
[[noreturn]] void throwCustom() {
throw CustomException( "custom exception - not std" );
}
#endif
TEST_CASE( "When checked exceptions are thrown they can be expected or unexpected", "[!throws]" ) {
REQUIRE_THROWS_AS( thisThrows(), std::domain_error );
REQUIRE_NOTHROW( thisDoesntThrow() );
@@ -198,8 +193,6 @@ TEST_CASE( "#748 - captures with unexpected exceptions", "[.][failing][!throws][
}
}
}} // namespace ExceptionTests
#ifdef __clang__
#pragma clang diagnostic pop
#endif