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
commit1e5534dde930d2b7eb2580f2c459d1553f3a5971 (patch)
tree23dff96fa1a4b856388ce42f420ed4a9797b7108 /test/unit/testSparseVector.cxx
parent7daa6e47979594525c3dd82bb1afce44ac28b246 (diff)
downloadscintilla-mirror-1e5534dde930d2b7eb2580f2c459d1553f3a5971.tar.gz
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.
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 5bc710744..7f2a9e9af 100644
--- a/test/unit/testSparseVector.cxx
+++ b/test/unit/testSparseVector.cxx
@@ -165,6 +165,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);