2014-03-14 11:30:17 +01:00
|
|
|
#include <boost/algorithm/string/predicate.hpp>
|
|
|
|
#include "tests/unit-tests/unit_tests_globals.hpp"
|
|
|
|
#include <string>
|
2015-04-09 22:17:19 +02:00
|
|
|
#include <climits>
|
2014-03-14 11:30:17 +01:00
|
|
|
|
2015-04-30 09:29:10 +02:00
|
|
|
#include "concordia/common/config.hpp"
|
2014-03-14 11:30:17 +01:00
|
|
|
#include "concordia/example.hpp"
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE(exampleTest)
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_CASE( ExceedingId )
|
|
|
|
{
|
2015-04-30 09:29:10 +02:00
|
|
|
SUFFIX_MARKER_TYPE maxId = (SUFFIX_MARKER_TYPE_MAX_VALUE >> 8) - 1;
|
2015-04-09 22:17:19 +02:00
|
|
|
Example example1("Test", maxId);
|
2014-03-14 11:30:17 +01:00
|
|
|
|
|
|
|
bool exceptionThrown = false;
|
2015-04-15 14:14:10 +02:00
|
|
|
std::string message = "";
|
2014-03-14 11:30:17 +01:00
|
|
|
try {
|
2015-04-09 22:17:19 +02:00
|
|
|
Example example2("Test", maxId+1);
|
2014-03-14 11:30:17 +01:00
|
|
|
} 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()
|