From 7153448eb8dfe267f96eb55aee683172f15cc283 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 1 Dec 2019 19:53:48 +1100 Subject: 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. --- test/unit/testSparseVector.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/unit/testSparseVector.cxx') 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); -- cgit v1.2.3