#include "../include/iutest.hpp"
#if IUTEST_HAS_EXCEPTIONS
static void ExceptionFunction(int i)
{
switch( i )
{
case 0:
return;
case 1:
throw 2;
case 2:
throw ::std::bad_exception();
case 3:
throw "error";
case 4:
throw ::std::string("error");
default:
break;
}
}
IUTEST(AssertionTest, Exception)
{
}
#if !defined(_MSC_VER) || _MSC_VER >= 1310
class exception_test
{
public:
explicit exception_test(const ::std::vector<int>&)
{
IUTEST_SUPPRESS_UNREACHABLE_CODE_WARNING(throw ::std::exception());
}
};
IUTEST(AssertionTest, Exception2)
{
::std::vector<int> a;
}
#endif
#if IUTEST_HAS_CATCH_SEH_EXCEPTION_ASSERTION
{
int* p = reinterpret_cast<int*>(0x1234);
}
#endif
#endif
#if IUTEST_HAS_EXCEPTIONS
IUTEST(DISABLED_TestFailure, Exception)
{
}
IUTEST(DISABLED_TestFailure, UnexpectedException1)
{
throw "fail";
}
IUTEST(DISABLED_TestFailure, UnexpectedException2)
{
IUTEST_PRAGMA_WARN_PUSH()
IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_BEGIN()
IUTEST_PRAGMA_WARN_DISABLE_NONNULL()
strcpy(NULL, NULL);
IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_END()
IUTEST_PRAGMA_WARN_POP()
}
#endif
#define IUTEST_ASSERT_THROW_VALUE_STRCASEEQ(statement, expected_exception, expected_str)
throw value 文字列一致(大文字小文字区別なし) テスト
Definition: iutest.hpp:604
#define IUTEST_ASSERT_THROW(statement, expected_exception)
throw テスト
Definition: iutest.hpp:552
#define IUTEST_ASSERT_THROW_VALUE_STREQ(statement, expected_exception, expected_str)
throw value 文字列一致 テスト
Definition: iutest.hpp:591
#define IUTEST_EXPECT_THROW_VALUE_STREQ(statement, expected_exception, expected_str)
throw value 文字列一致 テスト
Definition: iutest.hpp:1002
#define IUTEST_EXPECT_THROW_VALUE_EQ(statement, expected_exception, expected_value)
throw value == テスト
Definition: iutest.hpp:976
#define IUTEST_EXPECT_THROW_VALUE_STRCASEEQ(statement, expected_exception, expected_str)
throw value 文字列一致(大文字小文字区別なし) テスト
Definition: iutest.hpp:1015
#define IUTEST_EXPECT_THROW(statement, expected_exception)
throw テスト
Definition: iutest.hpp:963
#define IUTEST_EXPECT_THROW_VALUE_NE(statement, expected_exception, v)
throw value != テスト
Definition: iutest.hpp:989
#define IUTEST_EXPECT_ANY_THROW(statement)
any throw テスト
Definition: iutest.hpp:1026
#define IUTEST_EXPECT_NO_THROW(statement)
no throw テスト
Definition: iutest.hpp:1036
#define IUTEST(testsuite_, testname_)
テスト関数定義マクロ
Definition: iutest.hpp:72