aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unit/testSplitVector.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-05-02 09:01:54 +1000
committerNeil <nyamatongwe@gmail.com>2020-05-02 09:01:54 +1000
commit4535b0d9ce9c3be4bb9a02973485427ae67e61d9 (patch)
tree43689d33f07e3c3518e9706d25040672bc288551 /test/unit/testSplitVector.cxx
parent436402964655f4816e9526b804a5f19b273d6adc (diff)
downloadscintilla-mirror-4535b0d9ce9c3be4bb9a02973485427ae67e61d9.tar.gz
InsertEmpty now returns a pointer to the newly added elements to allow caller to
efficiently set those elements.
Diffstat (limited to 'test/unit/testSplitVector.cxx')
-rw-r--r--test/unit/testSplitVector.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/testSplitVector.cxx b/test/unit/testSplitVector.cxx
index a1426d38a..8a688cd5c 100644
--- a/test/unit/testSplitVector.cxx
+++ b/test/unit/testSplitVector.cxx
@@ -168,6 +168,27 @@ TEST_CASE("SplitVector") {
}
}
+ SECTION("InsertEmpty") {
+ sv.InsertEmpty(0, 0);
+ REQUIRE(0 == sv.Length());
+ int *pi = sv.InsertEmpty(0, 2);
+ REQUIRE(2 == sv.Length());
+ REQUIRE(0 == sv.ValueAt(0));
+ REQUIRE(0 == sv.ValueAt(1));
+ pi[0] = 4;
+ pi[1] = 5;
+ REQUIRE(4 == sv.ValueAt(0));
+ REQUIRE(5 == sv.ValueAt(1));
+ pi = sv.InsertEmpty(1, 2);
+ pi[0] = 6;
+ pi[1] = 7;
+ REQUIRE(4 == sv.Length());
+ REQUIRE(4 == sv.ValueAt(0));
+ REQUIRE(6 == sv.ValueAt(1));
+ REQUIRE(7 == sv.ValueAt(2));
+ REQUIRE(5 == sv.ValueAt(3));
+ }
+
SECTION("SetValue") {
sv.InsertValue(0, 10, 0);
sv.SetValueAt(5, 3);