X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=test%2Fparser_suite.h;h=bb3bd7601c8a986680281f49d4b5371154149de2;hb=594f207ec821583752337d6b1baf2cab1bf03dcb;hp=c7970f7aeb8579885462d43e6f084f30574505f6;hpb=1a0196cdd6520face4458ce1645744d7d6a4b1f7;p=nothing.git diff --git a/test/parser_suite.h b/test/parser_suite.h index c7970f7a..bb3bd760 100644 --- a/test/parser_suite.h +++ b/test/parser_suite.h @@ -54,6 +54,24 @@ TEST(read_expr_from_file_test) return 0; } +TEST(parse_reals_test) +{ + Gc *gc = create_gc(); + + const char *input = "3.1415"; + struct ParseResult result = read_expr_from_string(gc, input); + + ASSERT_FALSE(result.is_error, { + fprintf(stderr, "Parsing failed: %s\n", result.error_message); + }); + + EPIC_ASSERT_EQ(struct Expr, result.expr, REAL(gc, 3.1416f)); + + destroy_gc(gc); + + return 0; +} + TEST(parse_negative_integers_test) { Gc *gc = create_gc(); @@ -191,6 +209,7 @@ TEST_SUITE(parser_suite) // TODO(#467): read_all_exprs_from_string_bad_test is failing TEST_IGNORE(read_all_exprs_from_string_bad_test); TEST_RUN(read_all_exprs_from_string_trailing_spaces_test); + TEST_RUN(parse_reals_test); return 0; }