aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unit/testWordList.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/testWordList.cxx')
-rw-r--r--test/unit/testWordList.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/testWordList.cxx b/test/unit/testWordList.cxx
index 4d7805d1e..3970d37d4 100644
--- a/test/unit/testWordList.cxx
+++ b/test/unit/testWordList.cxx
@@ -26,6 +26,21 @@ TEST_CASE("WordList") {
REQUIRE(!wl.InList("class"));
}
+ SECTION("Set") {
+ // Check whether Set returns whether it has changed correctly
+ const bool changed = wl.Set("else struct");
+ REQUIRE(changed);
+ // Changing to same thing
+ const bool changed2 = wl.Set("else struct");
+ REQUIRE(!changed2);
+ // Changed order shouldn't be seen as a change
+ const bool changed3 = wl.Set("struct else");
+ REQUIRE(!changed3);
+ // Removing word is a change
+ const bool changed4 = wl.Set("struct");
+ REQUIRE(changed4);
+ }
+
SECTION("WordAt") {
wl.Set("else struct");
REQUIRE(0 == strcmp(wl.WordAt(0), "else"));