From c0fe4b0747d3abd22b6113ba8fbbfdaf029bb7c1 Mon Sep 17 00:00:00 2001 From: oirfeodent Date: Wed, 7 Sep 2016 13:55:11 +1000 Subject: Add test cases for WordList::InListAbbreviated. --- test/unit/testWordList.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/unit/testWordList.cxx b/test/unit/testWordList.cxx index e5874c01c..7abedd157 100644 --- a/test/unit/testWordList.cxx +++ b/test/unit/testWordList.cxx @@ -29,6 +29,22 @@ TEST_CASE("WordList") { REQUIRE(0 == strcmp(wl.WordAt(0), "else")); } + SECTION("InListAbbreviated") { + wl.Set("else stru~ct w~hile"); + REQUIRE(wl.InListAbbreviated("else", '~')); + + REQUIRE(wl.InListAbbreviated("struct", '~')); + REQUIRE(wl.InListAbbreviated("stru", '~')); + REQUIRE(wl.InListAbbreviated("struc", '~')); + REQUIRE(!wl.InListAbbreviated("str", '~')); + + REQUIRE(wl.InListAbbreviated("while", '~')); + REQUIRE(wl.InListAbbreviated("wh", '~')); + // TODO: Next line fails but should allow single character prefixes + //REQUIRE(wl.InListAbbreviated("w", '~')); + REQUIRE(!wl.InListAbbreviated("", '~')); + } + SECTION("InListAbridged") { wl.Set("list w.~.active bo~k a~z ~_frozen"); REQUIRE(wl.InListAbridged("list", '~')); -- cgit v1.2.3