concordia-library/concordia/t/test_example.cpp
rjawor 2533fd5b44 extended markers - length, bitwise operators
Former-commit-id: 948a7fc68bf0b2284ce631d877fc13fa3eaa4882
2015-04-09 22:17:19 +02:00

31 lines
743 B
C++

#include <boost/algorithm/string/predicate.hpp>
#include "tests/unit-tests/unit_tests_globals.hpp"
#include <string>
#include <climits>
#include "concordia/example.hpp"
using namespace std;
BOOST_AUTO_TEST_SUITE(exampleTest)
BOOST_AUTO_TEST_CASE( ExceedingId )
{
unsigned long maxId = (ULLONG_MAX >> 8) - 1;
Example example1("Test", maxId);
bool exceptionThrown = false;
string message = "";
try {
Example example2("Test", maxId+1);
} 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()