46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
|
|
#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;
|
||
|
|
}
|