]> git.mdlowis.com Git - proto/obnc.git/commitdiff
condensed constant declaration tests
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 21 Apr 2021 17:58:42 +0000 (13:58 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 21 Apr 2021 17:58:42 +0000 (13:58 -0400)
cerise/parser.c

index a5a9f697f479ae87ab820a94ef4a1bc9482740f7..16609c4eb276235860373539bd8f3760f4705493 100644 (file)
@@ -536,82 +536,48 @@ TEST_SUITE(Grammar)
 {
     TEST(Should parse basic module syntax)
     {
-        parse_module("Empty",
-            "module Empty; end Empty;");
-        parse_module("ModA",
-            "module ModA; import ModB; end ModA;");
+        parse_module("Empty", "module Empty; end Empty;");
+        parse_module("ModA",  "module ModA; import ModB; end ModA;");
     }
 
     TEST(Should parse imports)
     {
-        parse_rule(import_list, 0,
-            "import A;");
-        parse_rule(import_list, 0,
-            "import A = ModA;");
-        parse_rule(import_list, 0,
-            "import A, B;");
-        parse_rule(import_list, 0,
-            "import A, B = ModB, C;");
+        parse_rule(import_list, 0, "import A;");
+        parse_rule(import_list, 0, "import A = ModA;");
+        parse_rule(import_list, 0, "import A, B;");
+        parse_rule(import_list, 0, "import A, B = ModB, C;");
     }
 
     TEST(Should parse constant declarations and expressions)
     {
-        parse_rule(const_decl, 0,
-            "FOO = 123");
-        parse_rule(const_decl, 0,
-            "FOO = 123.123");
-        parse_rule(const_decl, 0,
-            "FOO = \"\"");
-        parse_rule(const_decl, 0,
-            "FOO = true");
-        parse_rule(const_decl, 0,
-            "FOO = false");
-//        parse_rule(const_decl, 0,
-//            "FOO = nil");
-        parse_rule(const_decl, 0,
-            "FOO = not true");
-        parse_rule(const_decl, 0,
-            "FOO = (not false)");
-        parse_rule(const_decl, 0,
-            "FOO = +1");
-        parse_rule(const_decl, 0,
-            "FOO = -1");
-        parse_rule(const_decl, 0,
-            "FOO = +1.0");
-        parse_rule(const_decl, 0,
-            "FOO = -1.0");
-        parse_rule(const_decl, 0,
-            "FOO = 1 + 2");
-        parse_rule(const_decl, 0,
-            "FOO = 1.0 + 2.0");
-        parse_rule(const_decl, 0,
-            "FOO = 1 - 2");
-        parse_rule(const_decl, 0,
-            "FOO = 1.0 - 2.0");
-        parse_rule(const_decl, 0,
-            "FOO = 3 * 2");
-        parse_rule(const_decl, 0,
-            "FOO = 3.0 * 2.0");
-        parse_rule(const_decl, 0,
-            "FOO = 4 / 2");
-        parse_rule(const_decl, 0,
-            "FOO = 3.0 / 4.0");
-        parse_rule(const_decl, 0,
-            "FOO = 5 % 3");
-        parse_rule(const_decl, 0,
-            "FOO = 5 == 3");
-        parse_rule(const_decl, 0,
-            "FOO = 5 != 3");
-        parse_rule(const_decl, 0,
-            "FOO = 5 < 3");
-        parse_rule(const_decl, 0,
-            "FOO = 5 <= 3");
-        parse_rule(const_decl, 0,
-            "FOO = 5 > 3");
-        parse_rule(const_decl, 0,
-            "FOO = 5 >= 3");
-        parse_rule(const_decl, 0,
-            "FOO = 5, BAR = FOO - 3");
+        parse_rule(const_decl, 0, "FOO = 123");
+        parse_rule(const_decl, 0, "FOO = 123.123");
+        parse_rule(const_decl, 0, "FOO = \"\"");
+        parse_rule(const_decl, 0, "FOO = true");
+        parse_rule(const_decl, 0, "FOO = false");
+//        parse_rule(const_decl, 0, "FOO = nil");
+        parse_rule(const_decl, 0, "FOO = not true");
+        parse_rule(const_decl, 0, "FOO = (not false)");
+        parse_rule(const_decl, 0, "FOO = +1");
+        parse_rule(const_decl, 0, "FOO = -1");
+        parse_rule(const_decl, 0, "FOO = +1.0");
+        parse_rule(const_decl, 0, "FOO = -1.0");
+        parse_rule(const_decl, 0, "FOO = 1 + 2");
+        parse_rule(const_decl, 0, "FOO = 1.0 + 2.0");
+        parse_rule(const_decl, 0, "FOO = 1 - 2");
+        parse_rule(const_decl, 0, "FOO = 1.0 - 2.0");
+        parse_rule(const_decl, 0, "FOO = 3 * 2");
+        parse_rule(const_decl, 0, "FOO = 3.0 * 2.0");
+        parse_rule(const_decl, 0, "FOO = 4 / 2");
+        parse_rule(const_decl, 0, "FOO = 3.0 / 4.0");
+        parse_rule(const_decl, 0, "FOO = 5 % 3");
+        parse_rule(const_decl, 0, "FOO = 5 == 3");
+        parse_rule(const_decl, 0, "FOO = 5 != 3");
+        parse_rule(const_decl, 0, "FOO = 5 < 3");
+        parse_rule(const_decl, 0, "FOO = 5 <= 3");
+        parse_rule(const_decl, 0, "FOO = 5 > 3");
+        parse_rule(const_decl, 0, "FOO = 5 >= 3");
+        parse_rule(const_decl, 0, "FOO = 5, BAR = FOO - 3");
     }
 }
 #endif