comparison ext/UnitTest++/src/tests/TestAssertHandler.cpp @ 37:0d325e9d5953

added unittest++ files into ext. Not hooked into build scripts yet
author jasoka@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 12 Jul 2008 12:00:57 +0000
parents
children
comparison
equal deleted inserted replaced
36:6f1227f4932b 37:0d325e9d5953
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 }