File: DcmtkException.cpp

package info (click to toggle)
odil 0.13.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,476 kB
  • sloc: cpp: 55,982; python: 3,947; javascript: 460; xml: 182; makefile: 99; sh: 36
file content (26 lines) | stat: -rw-r--r-- 869 bytes parent folder | download | duplicates (6)
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
#define BOOST_TEST_MODULE DcmtkException
#include <boost/test/unit_test.hpp>

#include <dcmtk/config/osconfig.h>
#include <dcmtk/ofstd/ofcond.h>

#include "odil/dcmtk/Exception.h"

BOOST_AUTO_TEST_CASE(StringConstructor)
{
    odil::dcmtk::Exception const exception("foo");
    BOOST_REQUIRE(
        exception.get_source() == odil::dcmtk::Exception::Source::Message);
    BOOST_REQUIRE_EQUAL(exception.what(), "foo");
    BOOST_REQUIRE_THROW(exception.get_condition(), odil::dcmtk::Exception);
}

BOOST_AUTO_TEST_CASE(ConditionConstructor)
{
    odil::dcmtk::Exception const exception(EC_IllegalParameter);
    BOOST_REQUIRE(
        exception.get_source() == odil::dcmtk::Exception::Source::Condition);
    BOOST_REQUIRE_EQUAL(
        exception.what(), OFCondition(EC_IllegalParameter).text());
    BOOST_REQUIRE(exception.get_condition() == EC_IllegalParameter);
}