16 lines
415 B
C
16 lines
415 B
C
|
|
#include "types.h"
|
||
|
|
#include "basic.h"
|
||
|
|
|
||
|
|
|
||
|
|
int main(void)
|
||
|
|
{
|
||
|
|
struct basic_expr *expr;
|
||
|
|
expr = basic_parse_expr("1 + 1");
|
||
|
|
if ( expr == NULL ) return 1;
|
||
|
|
if ( expr->lval_type != BASIC_LVAL_CONST ) return 2;
|
||
|
|
if ( expr->rval_type != BASIC_RVAL_CONST ) return 3;
|
||
|
|
if ( expr->lval.i != 1 ) return 4;
|
||
|
|
if ( expr->rval.i != 1 ) return 5;
|
||
|
|
if ( expr->type != BASIC_OPTP_ADD ) return 6;
|
||
|
|
return 0;
|
||
|
|
}
|