void ThrowTestSuite test_throw Will fail since the none of the functio

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void ThrowTestSuite::test_throw()
{
// Will fail since the none of the functions throws anything
//
TEST_THROWS_MSG(func(), int, "func() does not throw, expected int exception")
TEST_THROWS_MSG(func_no_throw(), int, "func_no_throw() does not throw, expected int exception")
TEST_THROWS_ANYTHING_MSG(func(), "func() does not throw, expected any exception")
TEST_THROWS_ANYTHING_MSG(func_no_throw(), "func_no_throw() does not throw, expected any exception")
// Will succeed since none of the functions throws anything
//
TEST_THROWS_NOTHING(func())
TEST_THROWS_NOTHING(func_no_throw())
// Will succeed since func_throw_int() throws an int
//
TEST_THROWS(func_throw_int(), int)
TEST_THROWS_ANYTHING(func_throw_int())
// Will fail since func_throw_int() throws an int (not a float)
//
TEST_THROWS_MSG(func_throw_int(), float, "func_throw_int() throws an int, expected a float exception")
TEST_THROWS_NOTHING_MSG(func_throw_int(), "func_throw_int() throws an int, expected no exception at all")
}