diff options
author | Yury Melnichek <melnichek@gmail.com> | 2012-09-25 22:38:21 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:43:53 +0300 |
commit | 0b94624aa9ab1454d4c89ec8b9ca6e87497c1552 (patch) | |
tree | a1328f1e04eacbd78aa2ff4b2fb71e47391f986b /coding | |
parent | dfb2db05de730607a7496e2f9d89424b49d5ae30 (diff) |
Add a unit test for incorrect DDVector size.
Diffstat (limited to 'coding')
-rw-r--r-- | coding/coding_tests/dd_vector_test.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/coding/coding_tests/dd_vector_test.cpp b/coding/coding_tests/dd_vector_test.cpp index a166d6bd14..9eadfb87b2 100644 --- a/coding/coding_tests/dd_vector_test.cpp +++ b/coding/coding_tests/dd_vector_test.cpp @@ -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, ()); +} |