#include "basic.h"
#include "stdlib.h"
#include "string.h"
#include <stdio.h>
char *_tokenize(char *ptr, char *token);
char *_token_get(void);
#define assert_token_value(str, val, ret_null, ret_neq) \
ptr = _tokenize(str, BASIC_TOKENIZER_TOKENS); \
value = _token_get(); \
if ( ptr == NULL ) return ret_null; \
rc = strcmp(value, val); \
printf("(%s) => (value) == (val) ? : (%s) == (%s) %d\n", str, value, val, rc); \
if ( rc != 0 ) return ret_neq;
int main(void)
{
char *ptr = NULL;
char *value = NULL;
int rc = 0;
assert_token_value("1+1", "1", 1, 2);
assert_token_value("1 + 1", "1", 2, 3);
assert_token_value("10 + 10", "10", 4, 5);
assert_token_value("1+ 2", "1", 6, 7)
assert_token_value("+ 2", "+", 8, 9)
return 0;
}