Add a unit test for incorrect DDVector size.

This commit is contained in:
Yury Melnichek 2012-09-25 20:38:21 +02:00 committed by Alex Zolotarev
parent dfb2db05de
commit 0b94624aa9

View file

@ -22,3 +22,22 @@ UNIT_TEST(DDVector)
for (size_t i = 0; i < v.size(); ++i, ++it)
TEST_EQUAL(v[i], *it, ());
}
UNIT_TEST(DDVector_IncorrectSize)
{
typedef DDVector<uint16_t, MemReader> Vector;
char const data[] = "ab";
MemReader reader(data, ARRAY_SIZE(data));
bool exceptionCaught = false;
try
{
Vector v(reader);
}
catch (Vector::OpenException & e)
{
exceptionCaught = true;
}
TEST(exceptionCaught, ());
}