Initial work on the WBT parser and its test suite

This commit is contained in:
2026-06-25 22:45:08 +03:00
commit 94cc652049
10 changed files with 219 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
#include <iostream>
#include <fstream>
import wbt;
void test_parse_no_expressions() {
std::ifstream i("test/test_parse_no_expressions.wbt", std::ios_base::in);
std::ostream o(std::cout.rdbuf());
const WBT_Parser p(i, o);
p.parse();
}
void test_parse_single_expression() {
std::ifstream i("test/test_parse_single_expression.wbt", std::ios_base::in);
std::ostream o(std::cout.rdbuf());
const WBT_Parser p(i, o);
p.parse();
}
void test_parse_invalid_character_expression() {
std::ifstream i("test/test_parse_invalid_character_expression.wbt", std::ios_base::in);
std::ostream o(std::cout.rdbuf());
const WBT_Parser p(i, o);
p.parse();
}
void test_parse_unclosed_expression() {
std::ifstream i("test/test_parse_unclosed_expression.wbt", std::ios_base::in);
std::ostream o(std::cout.rdbuf());
const WBT_Parser p(i, o);
p.parse();
}
int main() {
std::cout << std::endl << "-----" << std::endl;
test_parse_no_expressions();
std::cout << std::endl << "-----" << std::endl;
test_parse_single_expression();
std::cout << std::endl << "-----" << std::endl;
test_parse_invalid_character_expression();
std::cout << std::endl << "-----" << std::endl;
test_parse_unclosed_expression();
std::cout << std::endl << "-----" << std::endl;
}