diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-06-20 10:25:09 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-06-20 10:28:48 +0200 |
| commit | a4b92ca698770dc64639e51c76edb5dee16d2792 (patch) | |
| tree | 68f2dd6d99f50f5dd5d875703a1999863e9a650a /ttwhy/scanners/ansi.tests.cpp | |
| parent | c5f8cd91186adbe9c68835675a019449cc275c6d (diff) | |
| download | ttwhy-a4b92ca698770dc64639e51c76edb5dee16d2792.tar.xz ttwhy-a4b92ca698770dc64639e51c76edb5dee16d2792.zip | |
lib: switch to policy based scanner design
Diffstat (limited to 'ttwhy/scanners/ansi.tests.cpp')
| -rw-r--r-- | ttwhy/scanners/ansi.tests.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/ttwhy/scanners/ansi.tests.cpp b/ttwhy/scanners/ansi.tests.cpp deleted file mode 100644 index 6fdc8af..0000000 --- a/ttwhy/scanners/ansi.tests.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include <catch2/catch_test_macros.hpp> - -#include <string_view> // IWYU pragma: keep -#include <variant> -#include <vector> - -import ttwhy.scanners; - -using namespace std::string_view_literals; - -[[nodiscard]] constexpr auto static is_character(ttwhy::scanners::input_event & event, char expected) -> bool -{ - auto const * data = std::get_if<ttwhy::scanners::character_event>(&event); - return data != nullptr && data->value == expected; -} - -SCENARIO("The ANSI scanner processes printable ASCII and standard C0 control characters", "[scanner][ansi]") -{ - GIVEN("An initialized scanner and event sink") - { - auto queue = std::vector<ttwhy::scanners::input_event>{}; - auto sink = [&queue](auto const & event) { - queue.push_back(event); - }; - auto scanner = ttwhy::scanners::ansi{sink}; - - WHEN("Processing a standard printable character") - { - scanner.process("A"); - - THEN("It yields a single character event") - { - REQUIRE(queue.size() == 1); - CHECK(is_character(queue.at(0), 'A')); - } - } - } -} |
