diff options
Diffstat (limited to 'test/test_common.cpp')
-rw-r--r-- | test/test_common.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test_common.cpp b/test/test_common.cpp index 1486988..06f445a 100644 --- a/test/test_common.cpp +++ b/test/test_common.cpp @@ -1,7 +1,8 @@ #include "catch.hpp" #include "common.h" +#include <unordered_map> -TEST_CASE("load file", "[]") { +TEST_CASE("load file", "[common]") { line_view file{"\n111\n2222\n33333\n\n", 17}; const char* lines[] = {"\n", "111\n", "2222\n", "33333\n", "\n"}; int i = 0; @@ -14,7 +15,7 @@ TEST_CASE("load file", "[]") { lines); } -TEST_CASE("char count", "[]") { +TEST_CASE("char count", "[common]") { line_view line{"accad1\n", 7}; ascii_count ac{line}; REQUIRE(ac['\n'] == 1); @@ -23,3 +24,10 @@ TEST_CASE("char count", "[]") { REQUIRE(ac['d'] == 1); REQUIRE(ac['1'] == 1); } + +TEST_CASE("line_view hash", "[common]") { + std::unordered_map<line_view, int> h{{"abc", 1}, {"xyz", 2}}; + REQUIRE(h["abc"] == 1); + REQUIRE(h["xyz"] == 2); + REQUIRE(h.find("ab") == h.end()); +} |