diff options
author | Johannes Schickel | 2007-05-23 12:02:31 +0000 |
---|---|---|
committer | Johannes Schickel | 2007-05-23 12:02:31 +0000 |
commit | ad03c72bdb4eef62cbc05e432d7b49d3d2cd2038 (patch) | |
tree | c66a41c596a270e4a8867f25b65d50bf8b4b2f58 /test/common/array.h | |
parent | 81c218fe342bcb84cc0c5f55dd5867a2958f6764 (diff) | |
download | scummvm-rg350-ad03c72bdb4eef62cbc05e432d7b49d3d2cd2038.tar.gz scummvm-rg350-ad03c72bdb4eef62cbc05e432d7b49d3d2cd2038.tar.bz2 scummvm-rg350-ad03c72bdb4eef62cbc05e432d7b49d3d2cd2038.zip |
Commit of patch #1715313 ("CORE: STL like algorithm implementation").
svn-id: r26929
Diffstat (limited to 'test/common/array.h')
-rw-r--r-- | test/common/array.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/test/common/array.h b/test/common/array.h index f83c3bf0ea..8e1c53b430 100644 --- a/test/common/array.h +++ b/test/common/array.h @@ -59,4 +59,83 @@ class ArrayTestSuite : public CxxTest::TestSuite TS_ASSERT( array[1] == 33 ); TS_ASSERT( array[2] == -11 ); } + + void test_insert_at( void ) + { + Common::Array<int> array; + + // First of all some data + array.push_back(-12); + array.push_back(17); + array.push_back(25); + array.push_back(-11); + + // Insert some data + array.insert_at(2, 33); + + TS_ASSERT( array[0] == -12 ); + TS_ASSERT( array[1] == 17 ); + TS_ASSERT( array[2] == 33 ); + TS_ASSERT( array[3] == 25 ); + TS_ASSERT( array[4] == -11 ); + } + + void test_remove_at( void ) + { + Common::Array<int> array; + + // First of all some data + array.push_back(-12); + array.push_back(17); + array.push_back(33); + array.push_back(25); + array.push_back(-11); + + // Remove some data + array.remove_at(1); + + TS_ASSERT( array[0] == -12 ); + TS_ASSERT( array[1] == 33 ); + TS_ASSERT( array[2] == 25 ); + TS_ASSERT( array[3] == -11 ); + } + + void test_push_back( void ) + { + Common::Array<int> array1, array2; + + // Some data for both + array1.push_back(-3); + array1.push_back(5); + array1.push_back(9); + + array2.push_back(3); + array2.push_back(-2); + array2.push_back(-131); + + array1.push_back(array2); + + TS_ASSERT( array1[0] == -3 ); + TS_ASSERT( array1[1] == 5 ); + TS_ASSERT( array1[2] == 9 ); + TS_ASSERT( array1[3] == 3 ); + TS_ASSERT( array1[4] == -2 ); + TS_ASSERT( array1[5] == -131 ); + } + + void test_copy_constructor( void ) + { + Common::Array<int> array1; + + // Some data for both + array1.push_back(-3); + array1.push_back(5); + array1.push_back(9); + + Common::Array<int> array2(array1); + + TS_ASSERT( array2[0] == -3 ); + TS_ASSERT( array2[1] == 5 ); + TS_ASSERT( array2[2] == 9 ); + } }; |