diff options
| author | _ov4 <ov4@ov4.org> | 2026-09-17 11:33:27 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-09-17 11:33:27 +0000 |
| commit | 676e87af77769877a880b1624dc77bf036aac2f9 (patch) | |
| tree | 8a96f9ab7b651de54a4396232f94daaef623fab8 /module-test | |
| parent | ae2dbf4bc29ce57ffe701535f18c6e54f3f056f6 (diff) | |
add new parseline
Diffstat (limited to 'module-test')
| -rw-r--r-- | module-test/parseline_test.cc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/module-test/parseline_test.cc b/module-test/parseline_test.cc new file mode 100644 index 0000000..047be48 --- /dev/null +++ b/module-test/parseline_test.cc @@ -0,0 +1,61 @@ +/* + * test lexer/parseline +$ +g++ \ + module-test/parseline_test.cc \ + src/lexer/parseline.cc \ + src/util/string.cc \ + -std=c++23 -Iinclude \ + -O0 -ggdb3 -fno-omit-frame-pointer -fno-inline -D_GLIBCXX_ASSERTIONS \ + -o module-test/parseline_test.out +*/ + +#include <iostream> +#include <print> + +#include "lexer/parseline.h" + +using namespace std; + +int main() +{ + int test_case = 0; + println("start test"); + cin >> test_case; + string s; + + switch (test_case) + { + case 0: + s = "alpha beta"; + break; + + case 1: + s = "alpha \'arg1 and arg2\'"; + break; + + case 2: + s = "alpha \'arg1 \" arg2 arg3 \'"; + break; + + case 3: + s = "alpha \'arg1 \"arg2 arg3\" arg4 \'"; + break; + + default: + return 0; + } + char **p = ov4::parseline(s); + if (p == nullptr) + { + println("Ooooops nullptr"); + return 0; + } + for (size_t i = 0; ; i++) + { + if (p[i] == nullptr) + break; + println("{}", p[i]); + } + return 0; +} |
