diff options
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/array.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/common/array.h b/test/common/array.h index de3f0decc5..68b4fa3a93 100644 --- a/test/common/array.h +++ b/test/common/array.h @@ -184,4 +184,28 @@ class ArrayTestSuite : public CxxTest::TestSuite TS_ASSERT_EQUALS(container.back(), -17); } + void test_resize() { + Common::Array<int> array; + + array.resize(3); + TS_ASSERT_EQUALS( array.size(), (unsigned int)3 ); + + array[0] = -3; + array[1] = 163; + array[2] = 17; + + array.resize(100); + TS_ASSERT_EQUALS( array.size(), (unsigned int)100 ); + TS_ASSERT_EQUALS( array[0], -3 ); + TS_ASSERT_EQUALS( array[1], 163 ); + TS_ASSERT_EQUALS( array[2], 17 ); + + TS_ASSERT_EQUALS( array[99], 0 ); + + array.resize(2); + TS_ASSERT_EQUALS( array.size(), (unsigned int)2 ); + TS_ASSERT_EQUALS( array[0], -3 ); + TS_ASSERT_EQUALS( array[1], 163 ); + } + }; |