2019-01-25 12:15:41 +00:00
/ * *
* Created by Aleksey Chichenkov < a . chichenkov @ initi . ru > on 1 / 25 / 19.
* /
var fs = require ( "fs" ) ;
var exec = require ( 'child_process' ) . exec ;
2019-01-25 13:30:02 +00:00
exec ( "node main.js -o=lexer_test.js -t=node" , function ( err , stdout , stderr ) {
2019-01-25 12:15:41 +00:00
err && console . log ( "ERROR: " , err ) ;
err && process . exit ( 1 ) ;
test ( ) ;
fs . unlinkSync ( "lexer_test.js" ) ;
} ) ;
var test = function ( ) {
var Lexer = require ( "./lexer_test" ) ;
console . log ( "TEST SINGLE" ) ;
( new Lexer ( "[" ) ) . search ( ) ;
( new Lexer ( "]" ) ) . search ( ) ;
( new Lexer ( "(" ) ) . search ( ) ;
2019-01-25 13:30:02 +00:00
( new Lexer ( ")" ) ) . search ( ) ;
2019-01-25 12:15:41 +00:00
( new Lexer ( ":" ) ) . search ( ) ;
( new Lexer ( "," ) ) . search ( ) ;
( new Lexer ( "." ) ) . search ( ) ;
( new Lexer ( "%" ) ) . search ( ) ;
( new Lexer ( ">" ) ) . search ( ) ;
( new Lexer ( ">=" ) ) . search ( ) ;
( new Lexer ( "<" ) ) . search ( ) ;
( new Lexer ( "<=" ) ) . search ( ) ;
( new Lexer ( "==" ) ) . search ( ) ;
( new Lexer ( "!=" ) ) . search ( ) ;
( new Lexer ( "AND" ) ) . search ( ) ;
( new Lexer ( "and" ) ) . search ( ) ;
( new Lexer ( "OR" ) ) . search ( ) ;
( new Lexer ( "or" ) ) . search ( ) ;
( new Lexer ( "NOT" ) ) . search ( ) ;
( new Lexer ( "not" ) ) . search ( ) ;
( new Lexer ( "LIKE" ) ) . search ( ) ;
( new Lexer ( "like" ) ) . search ( ) ;
( new Lexer ( "NLIKE" ) ) . search ( ) ;
( new Lexer ( "nlike" ) ) . search ( ) ;
( new Lexer ( "Address" ) ) . search ( ) ;
2019-01-28 15:36:41 +00:00
( new Lexer ( "Oid" ) ) . search ( ) ;
2019-01-25 12:15:41 +00:00
( new Lexer ( "Time" ) ) . search ( ) ;
( new Lexer ( "TimeDiff" ) ) . search ( ) ;
var lex _test _all = new Lexer ( "[ ] ( ) : , . % > >= < <= == != AND and OR or NOT not LIKE like NLIKE nlike Address Time TimeDiff 'sdfadfasdf' \"asdfasfd\" " )
var _lex ;
console . log ( "start search" ) ;
while ( _lex = lex _test _all . next ( ) ) ;
console . log ( "TEST STRING LITERAL" ) ;
( new Lexer ( ' "111\\\"11\\\"1" "222222" ' ) ) . search ( ) ;
( new Lexer ( " '111\\\'11\\\'1' '222222' " ) ) . search ( ) ;
2019-01-28 15:36:41 +00:00
console . log ( "\nSuccess tests\n" ) ;
2019-01-25 12:15:41 +00:00
} ;