From b2d8c5140ed21be9a4550de2bd03876ae38fc8e8 Mon Sep 17 00:00:00 2001 From: Pawel Lampe Date: Mon, 14 Sep 2020 20:21:07 +0200 Subject: Add test cases for numeric literals with underscores --- tests/test_expression.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_expression.h b/tests/test_expression.h index 85d37d1460..8c026a35f5 100644 --- a/tests/test_expression.h +++ b/tests/test_expression.h @@ -148,6 +148,20 @@ TEST_CASE("[Expression] Scientific notation") { "The expression should return the expected result."); } +TEST_CASE("[Expression] Underscored numeric literals") { + Expression expression; + + CHECK_MESSAGE( + expression.parse("1_000_000") == OK, + "The expression should parse successfully."); + CHECK_MESSAGE( + expression.parse("1_000.000") == OK, + "The expression should parse successfully."); + CHECK_MESSAGE( + expression.parse("0xff_99_00") == OK, + "The expression should parse successfully."); +} + TEST_CASE("[Expression] Built-in functions") { Expression expression; -- cgit v1.2.3