diff options
| author | hachem <im@hachem.wtf> | 2026-08-31 17:55:16 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2026-08-31 17:55:16 +0200 |
| commit | cbdb9073480c3e4d8a088b306c23406cf42e25c0 (patch) | |
| tree | 39f3093654cc8f27ea701ed1338cac84d93f42eb /tests/lexer_test.c | |
| parent | 53aed3fadf1f7ad66dea9a8a0b46bf42eda921be (diff) | |
feat: hex/binary integer literals and constant-folding const expressions
Diffstat (limited to 'tests/lexer_test.c')
| -rw-r--r-- | tests/lexer_test.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/lexer_test.c b/tests/lexer_test.c index f677793..7260d6c 100644 --- a/tests/lexer_test.c +++ b/tests/lexer_test.c @@ -20,6 +20,14 @@ static void test_identifiers_and_integers(struct TestContext* context) check(context, scan_token(&lexer).type == TOKEN_EOF); } +static void test_number_bases(struct TestContext* context) +{ + struct Lexer lexer = create_lexer("42 0x1F 0b1010"); + check(context, token_matches(scan_token(&lexer), TOKEN_INTEGER, "42")); + check(context, token_matches(scan_token(&lexer), TOKEN_INTEGER, "0x1F")); + check(context, token_matches(scan_token(&lexer), TOKEN_INTEGER, "0b1010")); +} + static void test_operators(struct TestContext* context) { struct Lexer lexer = create_lexer("= == += != /"); @@ -76,6 +84,7 @@ static void test_comments(struct TestContext* context) void run_lexer_tests(struct TestContext* context) { test_identifiers_and_integers(context); + test_number_bases(context); test_operators(context); test_literals(context); test_keywords(context); |
