aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unit/testSparseVector.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-12-01 19:53:48 +1100
committerNeil <nyamatongwe@gmail.com>2019-12-01 19:53:48 +1100
commit7153448eb8dfe267f96eb55aee683172f15cc283 (patch)
tree026adfb64a1529bff16e9c49e1c1510c9184f560 /test/unit/testSparseVector.cxx
parentbce262ab46a8e485febb8e8b6311356ea7571af1 (diff)
downloadscintilla-mirror-7153448eb8dfe267f96eb55aee683172f15cc283.tar.gz
Backport: Fix a bug with deleting the first element in SparseVector that left an extra
empty partition. Add extra checking to Partitioning and turn on checking for UnitTester. Backport of changeset 7777:12fb0335514e.
Diffstat (limited to 'test/unit/testSparseVector.cxx')
-rw-r--r--test/unit/testSparseVector.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/testSparseVector.cxx b/test/unit/testSparseVector.cxx
index ce3b9706b..df7b412ce 100644
--- a/test/unit/testSparseVector.cxx
+++ b/test/unit/testSparseVector.cxx
@@ -164,6 +164,22 @@ TEST_CASE("SparseVector") {
st.Check();
}
+ SECTION("CheckDeletionLeavesOrdered") {
+ REQUIRE(1 == st.Elements());
+ st.InsertSpace(0, 1);
+ st.SetValueAt(0, UniqueStringCopy("1"));
+ REQUIRE("1" == Representation(st));
+ REQUIRE(1 == st.Elements());
+ st.InsertSpace(1, 1);
+ st.SetValueAt(1, UniqueStringCopy("2"));
+ REQUIRE("12" == Representation(st));
+ st.DeletePosition(0);
+ REQUIRE("2" == Representation(st));
+ REQUIRE(1 == st.Elements());
+ st.DeletePosition(0);
+ REQUIRE("" == Representation(st));
+ }
+
SECTION("DeleteAll") {
REQUIRE(1 == st.Elements());
st.InsertSpace(0, 10);