concordia-library/concordia/t/test_example.cpp
rjawor 4b921decae limits control
Former-commit-id: 83d90cb63b3f1447938d16010e66f4345dfe0617
2014-03-14 11:30:17 +01:00

30 lines
680 B
C++

#include <boost/algorithm/string/predicate.hpp>
#include "tests/unit-tests/unit_tests_globals.hpp"
#include <string>
#include "concordia/example.hpp"
using namespace std;
BOOST_AUTO_TEST_SUITE(exampleTest)
BOOST_AUTO_TEST_CASE( ExceedingId )
{
Example example1("Test", 16777215);
bool exceptionThrown = false;
string message = "";
try {
Example example2("Test", 16777216);
} catch (ConcordiaException & e) {
exceptionThrown = true;
message = e.what();
}
BOOST_CHECK_EQUAL(exceptionThrown, true);
BOOST_CHECK_EQUAL(boost::starts_with(message, "Example id too large"), true);
}
BOOST_AUTO_TEST_SUITE_END()