aboutsummaryrefslogtreecommitdiff
path: root/tests/lexer_test.c
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-31 23:14:26 +0200
committerhachem <im@hachem.wtf>2026-08-31 23:14:26 +0200
commit9dc06d01c2224ee1dbeb11ebee7c8afecfac8b05 (patch)
tree110fe30b5b1f228568087a8fe7b0f7e0ca43fbb1 /tests/lexer_test.c
parent5b06b0e4b8effaacd23308d6a6b26c525e7d3af4 (diff)
feat: add support for floats through xmm registers
Diffstat (limited to 'tests/lexer_test.c')
-rw-r--r--tests/lexer_test.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/lexer_test.c b/tests/lexer_test.c
index 38644d9..a44b1f0 100644
--- a/tests/lexer_test.c
+++ b/tests/lexer_test.c
@@ -28,6 +28,14 @@ static void test_number_bases(struct TestContext* context)
check(context, token_matches(scan_token(&lexer), TOKEN_INTEGER, "0b1010"));
}
+static void test_float_literals(struct TestContext* context)
+{
+ struct Lexer lexer = create_lexer("3.14 1.0 42");
+ check(context, token_matches(scan_token(&lexer), TOKEN_FLOAT, "3.14"));
+ check(context, token_matches(scan_token(&lexer), TOKEN_FLOAT, "1.0"));
+ check(context, scan_token(&lexer).type == TOKEN_INTEGER);
+}
+
static void test_operators(struct TestContext* context)
{
struct Lexer lexer = create_lexer("= == += != /");
@@ -92,6 +100,7 @@ void run_lexer_tests(struct TestContext* context)
{
test_identifiers_and_integers(context);
test_number_bases(context);
+ test_float_literals(context);
test_operators(context);
test_literals(context);
test_keywords(context);