summaryrefslogtreecommitdiff
path: root/test/lexer_test.c
diff options
context:
space:
mode:
authorCarlos Maniero <carlosmaniero@gmail.com>2023-04-26 01:57:40 -0300
committerJohnny Richard <johnny@johnnyrichard.com>2023-04-26 09:11:11 +0200
commitb8e76aa1e888a4602d4220206bbea8d04882fae2 (patch)
tree03c5e03377edec588066b0d7d7ad9d1a80092b08 /test/lexer_test.c
parent127dae1c3b48c3a4dceddb9000309bfeaa8d0a01 (diff)
lexer: Split operation tokens into their own token
The +, -, *, and / tokens used to be TOKEN_OP, but the TOKEN_OP has been removed and a token for each operation has been introduced. Python's token names were followed: https://docs.python.org/3/library/token.html Signed-off-by: Carlos Maniero <carlosmaniero@gmail.com> Reviewed-by: Johnny Richard <johnny@johnnyrichar.com>
Diffstat (limited to 'test/lexer_test.c')
-rw-r--r--test/lexer_test.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/lexer_test.c b/test/lexer_test.c
index abfac16..bbb6784 100644
--- a/test/lexer_test.c
+++ b/test/lexer_test.c
@@ -64,14 +64,14 @@ test_tokenize_number(const MunitParameter params[], void *user_data_or_fixture)
static MunitResult
test_tokenize_op(const MunitParameter params[], void *user_data_or_fixture)
{
- assert_token_at(" + 2", 0, TOKEN_OP, "+");
- assert_token_at(" - \n", 0, TOKEN_OP, "-");
- assert_token_at(" * ;", 0, TOKEN_OP, "*");
- assert_token_at(" / ", 0, TOKEN_OP, "/");
- assert_token_at(" = ", 0, TOKEN_OP, "=");
+ assert_token_at(" + 2", 0, TOKEN_PLUS, "+");
+ assert_token_at(" - \n", 0, TOKEN_MINUS, "-");
+ assert_token_at(" * ;", 0, TOKEN_STAR, "*");
+ assert_token_at(" / ", 0, TOKEN_SLASH, "/");
+ assert_token_at(" = ", 0, TOKEN_EQUAL, "=");
assert_token_at("1 * 2", 0, TOKEN_NUMBER, "1");
- assert_token_at("1 * 2", 1, TOKEN_OP, "*");
+ assert_token_at("1 * 2", 1, TOKEN_STAR, "*");
assert_token_at("1 * 2", 2, TOKEN_NUMBER, "2");
return MUNIT_OK;