Initial work on the WBT parser and its test suite
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user