diff options
| author | Neil <nyamatongwe@gmail.com> | 2019-12-02 08:34:47 +1100 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2019-12-02 08:34:47 +1100 |
| commit | e9f310d4043e58739c9e661159a35847a7ba5df5 (patch) | |
| tree | 8254897533f01e93c3cc4f9baf7a5d57dd678862 /test/unit | |
| parent | 2892e0d04bcf02fe249939f7c22fe8c6d780233a (diff) | |
| download | scintilla-mirror-e9f310d4043e58739c9e661159a35847a7ba5df5.tar.gz | |
Backport: Add SparseVector::IndexAfter for efficiently finding elements in a range.
Backport of changeset 7779:67b7e8f152a9.
Diffstat (limited to 'test/unit')
| -rw-r--r-- | test/unit/testSparseVector.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/testSparseVector.cxx b/test/unit/testSparseVector.cxx index 4d3b872e1..c9fc58bf1 100644 --- a/test/unit/testSparseVector.cxx +++ b/test/unit/testSparseVector.cxx @@ -248,6 +248,23 @@ TEST_CASE("SparseTextInt") { REQUIRE(0 == st.ValueAt(4)); st.Check(); } + + SECTION("IndexAfter") { + st.InsertSpace(0, 5); + REQUIRE(1 == st.Elements()); + REQUIRE(0 == st.IndexAfter(-1)); + REQUIRE(0 == st.PositionOfElement(0)); + REQUIRE(1 == st.IndexAfter(0)); + REQUIRE(5 == st.PositionOfElement(1)); + st.SetValueAt(3, 3); + REQUIRE(2 == st.Elements()); + REQUIRE(0 == st.IndexAfter(-1)); + REQUIRE(0 == st.PositionOfElement(0)); + REQUIRE(1 == st.IndexAfter(0)); + REQUIRE(3 == st.PositionOfElement(1)); + REQUIRE(2 == st.IndexAfter(3)); + REQUIRE(5 == st.PositionOfElement(2)); + } } TEST_CASE("SparseTextString") { |
