-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathmain.cpp
91 lines (72 loc) · 1.39 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE PulseTest
#include <boost/test/unit_test.hpp>
#include <exception>
#include <unistd.h>
int add(int i, int j)
{
return i + j;
}
BOOST_AUTO_TEST_SUITE(VariantsSuite)
BOOST_AUTO_TEST_CASE(simplePass)
{
}
BOOST_AUTO_TEST_CASE(checkFailure)
{
BOOST_CHECK(add(2, 2) == 5);
}
BOOST_AUTO_TEST_CASE(multipleCheckFailures)
{
BOOST_CHECK(add(2, 2) == 1);
BOOST_CHECK(add(2, 2) == 2);
BOOST_CHECK(add(2, 2) == 3);
}
BOOST_AUTO_TEST_CASE(requireFailure)
{
BOOST_REQUIRE(add(2, 2) == 5);
}
BOOST_AUTO_TEST_CASE(explicitError)
{
BOOST_ERROR("Error message");
}
BOOST_AUTO_TEST_CASE(explicitFailure)
{
BOOST_FAIL("Failure message");
}
BOOST_AUTO_TEST_CASE(errorThenFailure)
{
BOOST_FAIL("Error message");
BOOST_FAIL("Failure message");
}
BOOST_AUTO_TEST_CASE(uncaughtException)
{
throw "Catch me if you can!";
}
BOOST_AUTO_TEST_CASE(stdException)
{
throw new std::exception();
}
BOOST_AUTO_TEST_CASE(checkMessageFailure)
{
BOOST_CHECK_MESSAGE(add(2, 2) == 5, "add(..) result: " << add(2, 2));
}
BOOST_AUTO_TEST_CASE(checkEqualFailure)
{
BOOST_CHECK_EQUAL(add( 2,2 ), 5);
}
BOOST_AUTO_TEST_CASE(threeSeconds)
{
sleep(3);
}
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(PassingSuite)
BOOST_AUTO_TEST_CASE(pass1)
{
}
BOOST_AUTO_TEST_CASE(pass2)
{
}
BOOST_AUTO_TEST_CASE(pass3)
{
}
BOOST_AUTO_TEST_SUITE_END()