-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_API.cpp
More file actions
35 lines (26 loc) · 779 Bytes
/
test_API.cpp
File metadata and controls
35 lines (26 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "fh_regex/tree/nodes.h"
#include "fh_regex/tree/nodes_tree.h"
#include "fh_regex/tree/regex_checker.h"
#include <ios>
#include <string_view>
#include <utility>
int main()
{
std::string_view pattern = "HE.";
RegexChecker checker(pattern);
std::string_view text = "HEA";
bool matches = false;
int i = 0;
for (auto symbol : text)
{
auto result = checker.make_next_step(symbol);
std::cout << "Result on " << ++i << " iteration is " << std::boolalpha << result << std::endl;
if (result == false)
{
break;
}
}
matches = i == (text.size()) && (i == (pattern.size()));
std::cout << "Expression does " << (matches ? "" : "not ") << "match text" << std::endl;
return 0;
}