Welcome to mirror list, hosted at ThFree Co, Russian Federation.

TestAssertHandler.cpp « tests « src « UnitTest++ « testing « src - github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a5fd07cead250d6792ac8678a833393c8b6eb3c7 (plain)
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
#include "../UnitTest++.h"
#include "../AssertException.h"
#include "../ReportAssert.h"

using namespace UnitTest;

namespace {

TEST(ReportAssertThrowsAssertException)
{
    bool caught = false;

    try
    {
        ReportAssert("", "", 0);
    }
    catch(AssertException const&)
    {
        caught = true;
    }

    CHECK (true == caught);
}

TEST(ReportAssertSetsCorrectInfoInException)
{
    const int lineNumber = 12345;
    const char* description = "description";
    const char* filename = "filename";

    try
    {
        ReportAssert(description, filename, lineNumber);
    }
    catch(AssertException const& e)
    {
        CHECK_EQUAL(description, e.what());
        CHECK_EQUAL(filename, e.Filename());
        CHECK_EQUAL(lineNumber, e.LineNumber());
    }
}


}