Mercurial > fife-parpg
comparison ext/UnitTest++/src/tests/TestAssertHandler.cpp @ 89:fa33cda75471
* Reverting back to 2543 as requested by sleek
author | mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sat, 19 Jul 2008 11:38:52 +0000 |
parents | 0d325e9d5953 |
children |
comparison
equal
deleted
inserted
replaced
88:1c2842ebe393 | 89:fa33cda75471 |
---|---|
1 #include "../UnitTest++.h" | |
2 #include "../AssertException.h" | |
3 #include "../ReportAssert.h" | |
4 | |
5 using namespace UnitTest; | |
6 | |
7 namespace { | |
8 | |
9 TEST(ReportAssertThrowsAssertException) | |
10 { | |
11 bool caught = false; | |
12 | |
13 try | |
14 { | |
15 ReportAssert("", "", 0); | |
16 } | |
17 catch(AssertException const&) | |
18 { | |
19 caught = true; | |
20 } | |
21 | |
22 CHECK (true == caught); | |
23 } | |
24 | |
25 TEST(ReportAssertSetsCorrectInfoInException) | |
26 { | |
27 const int lineNumber = 12345; | |
28 const char* description = "description"; | |
29 const char* filename = "filename"; | |
30 | |
31 try | |
32 { | |
33 ReportAssert(description, filename, lineNumber); | |
34 } | |
35 catch(AssertException const& e) | |
36 { | |
37 CHECK_EQUAL(description, e.what()); | |
38 CHECK_EQUAL(filename, e.Filename()); | |
39 CHECK_EQUAL(lineNumber, e.LineNumber()); | |
40 } | |
41 } | |
42 | |
43 | |
44 } |