diff options
author | Neil <nyamatongwe@gmail.com> | 2020-05-04 08:51:17 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2020-05-04 08:51:17 +1000 |
commit | 2175e34a7449f59ee6f9fa2466cbe13b6a92232e (patch) | |
tree | 4f79f04036f88905bea500406c8443db1545eee9 /test/unit/testPartitioning.cxx | |
parent | 4b450a69452a14fd9af6c426b91d04165fedc94a (diff) | |
download | scintilla-mirror-2175e34a7449f59ee6f9fa2466cbe13b6a92232e.tar.gz |
Feature [feature-requests:1347]. Add methods to insert multiple partitions.
Diffstat (limited to 'test/unit/testPartitioning.cxx')
-rw-r--r-- | test/unit/testPartitioning.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/testPartitioning.cxx b/test/unit/testPartitioning.cxx index 5a416f799..6abb6da44 100644 --- a/test/unit/testPartitioning.cxx +++ b/test/unit/testPartitioning.cxx @@ -95,6 +95,32 @@ TEST_CASE("Partitioning") { REQUIRE(8 == part.PositionFromPartition(2)); } + SECTION("InsertMultiple") { + part.InsertText(0, 10); + const Sci::Position positions[] { 2, 5, 7 }; + part.InsertPartitions(1, positions, std::size(positions)); + REQUIRE(4 == part.Partitions()); + REQUIRE(0 == part.PositionFromPartition(0)); + REQUIRE(2 == part.PositionFromPartition(1)); + REQUIRE(5 == part.PositionFromPartition(2)); + REQUIRE(7 == part.PositionFromPartition(3)); + REQUIRE(10 == part.PositionFromPartition(4)); + } + + SECTION("InsertMultipleWithCast") { + part.InsertText(0, 9); + REQUIRE(1 == part.Partitions()); + const ptrdiff_t positionsp[]{ 2, 4, 6, 8 }; + part.InsertPartitionsWithCast(1, positionsp, std::size(positionsp)); + REQUIRE(5 == part.Partitions()); + REQUIRE(0 == part.PositionFromPartition(0)); + REQUIRE(2 == part.PositionFromPartition(1)); + REQUIRE(4 == part.PositionFromPartition(2)); + REQUIRE(6 == part.PositionFromPartition(3)); + REQUIRE(8 == part.PositionFromPartition(4)); + REQUIRE(9 == part.PositionFromPartition(5)); + } + SECTION("InsertReversed") { part.InsertText(0, 3); part.InsertPartition(1, 2); |