Unit Tests

- Added tests for Lexer::boundary.
This commit is contained in:
Paul Beckingham 2014-06-18 17:46:05 -04:00
parent 008ba6ecab
commit e14c867a9b

View file

@ -36,7 +36,7 @@ Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (196);
UnitTest t (203);
std::vector <std::pair <std::string, Lexer::Type> > tokens;
std::string token;
@ -71,6 +71,15 @@ int main (int argc, char** argv)
t.ok (Lexer::is_ws (0x205F), "U+205F is_ws");
t.ok (Lexer::is_ws (0x3000), "U+3000 is_ws");
// static bool Lexer::boundary(int, int);
t.ok (Lexer::boundary (' ', 'a'), "' ' --> 'a' = boundary");
t.ok (Lexer::boundary ('a', ' '), "'a' --> ' ' = boundary");
t.ok (Lexer::boundary (' ', '+'), "' ' --> '+' = boundary");
t.ok (Lexer::boundary (' ', ','), "' ' --> ',' = boundary");
t.notok (Lexer::boundary ('3', '4'), "'3' --> '4' = boundary");
t.ok (Lexer::boundary ('(', '('), "'(' --> '(' = boundary");
t.notok (Lexer::boundary ('r', 'd'), "'r' --> 'd' = boundary");
// Should result in no tokens.
Lexer l0 ("");
t.notok (l0.token (token, type), "'' --> no tokens");