2
0
Эх сурвалжийг харах

Merge pull request #42064 from Scony/add-numeric-literals-test-cases

Add test cases for numeric literals with underscores
Rémi Verschelde 5 жил өмнө
parent
commit
ee36e08c26
1 өөрчлөгдсөн 14 нэмэгдсэн , 0 устгасан
  1. 14 0
      tests/test_expression.h

+ 14 - 0
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;