[Scummvm-git-logs] scummvm master -> 414787431480a3ee55913a1463a3521975f60504
ccawley2011
noreply at scummvm.org
Mon Jul 8 16:11:47 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
4147874314 TESTS: Add a test for erasing array ranges
Commit: 414787431480a3ee55913a1463a3521975f60504
https://github.com/scummvm/scummvm/commit/414787431480a3ee55913a1463a3521975f60504
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2024-07-08T17:11:34+01:00
Commit Message:
TESTS: Add a test for erasing array ranges
Changed paths:
test/common/array.h
diff --git a/test/common/array.h b/test/common/array.h
index e1538ca0734..eaade76b067 100644
--- a/test/common/array.h
+++ b/test/common/array.h
@@ -65,6 +65,31 @@ class ArrayTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS(array[1], -11);
}
+ void test_erase_iterator_range() {
+ Common::Array<int> array;
+ Common::Array<int>::iterator first, last;
+
+ // Fill the array with some random data
+ array.push_back(17);
+ array.push_back(33);
+ array.push_back(66);
+ array.push_back(99);
+ array.push_back(-11);
+
+ first = array.begin();
+ ++first;
+
+ last = array.end();
+ --last;
+
+ first = array.erase(first, last);
+ TS_ASSERT_DIFFERS(first, array.end());
+ TS_ASSERT_EQUALS(*first, -11);
+ TS_ASSERT_EQUALS(array.size(), (unsigned int)2);
+ TS_ASSERT_EQUALS(array[0], 17);
+ TS_ASSERT_EQUALS(array[1], -11);
+ }
+
void test_insert_iterator() {
Common::Array<int> array;
Common::Array<int>::iterator iter;
More information about the Scummvm-git-logs
mailing list