diff options
author | Neil <nyamatongwe@gmail.com> | 2016-08-25 09:55:37 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2016-08-25 09:55:37 +1000 |
commit | c64f7049e22f8a41256128a6d9e0eb95e3ef170c (patch) | |
tree | d67523e5e359056594cacee7fc5e0bbbaccd8033 /test/unit/testWordList.cxx | |
parent | 6aa1a5517faa20d69598ffa88ed803406206ef7c (diff) | |
download | scintilla-mirror-c64f7049e22f8a41256128a6d9e0eb95e3ef170c.tar.gz |
Add unit tests for WordList class.
Diffstat (limited to 'test/unit/testWordList.cxx')
-rw-r--r-- | test/unit/testWordList.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit/testWordList.cxx b/test/unit/testWordList.cxx new file mode 100644 index 000000000..a4ccf4d6a --- /dev/null +++ b/test/unit/testWordList.cxx @@ -0,0 +1,32 @@ +// Unit Tests for Scintilla internal data structures + +#include <string.h> + +#include "WordList.h" + +#include "catch.hpp" + +// Test WordList. + +TEST_CASE("WordList") { + + WordList wl; + + SECTION("IsEmptyInitially") { + REQUIRE(0 == wl.Length()); + REQUIRE(!wl.InList("struct")); + } + + SECTION("InList") { + wl.Set("else struct"); + REQUIRE(2 == wl.Length()); + REQUIRE(wl.InList("struct")); + REQUIRE(!wl.InList("class")); + } + + SECTION("WordAt") { + wl.Set("else struct"); + REQUIRE(0 == strcmp(wl.WordAt(0), "else")); + } + +} |