DEADSOFTWARE

Добавлена конструкция CASE
[dsw-obn.git] / src / test.c
index a144f3616074e1f8891dbc30af0007420bad0ef9..0eb787ca9b45e4df2b49ec325567a651fd57636c 100644 (file)
@@ -9,36 +9,18 @@ static char source_test[] =
        "MODULE Test;"
        "IMPORT Out;"
        ""
-       "TYPE"
-       "  R = INTEGER;"
+       "VAR"
+       "  i : INTEGER;"
        ""
-       "PROCEDURE Factorial(n : R) : R;"
        "BEGIN"
-       "  IF n <= 1 THEN"
-       "    RETURN 1;"
+       "  Out.Open;"
+       "  CASE 666 OF"
+       "    2, 3, 4, 5: Out.String('Zero');"
+       "  | 10..20, 24: Out.String('Holy shit');"
        "  ELSE"
-       "    RETURN n * Factorial(n - 1);"
+       "    Out.String('Something else');"
        "  END;"
-       "  RETURN 0; (* Детектор ретурнов - дерьмо *)"
-       "END Factorial;"
-       ""
-       "BEGIN"
-       "  Out.Open();"
-       "  Out.Int(Factorial(0), 0); Out.Ln;"
-       "  Out.Int(Factorial(1), 0); Out.Ln;"
-       "  Out.Int(Factorial(2), 0); Out.Ln;"
-       "  Out.Int(Factorial(3), 0); Out.Ln;"
-       "  Out.Int(Factorial(4), 0); Out.Ln;"
-       "  Out.Int(Factorial(5), 0); Out.Ln;"
-       "  Out.Int(Factorial(6), 0); Out.Ln;"
-       "  Out.Int(Factorial(7), 0); Out.Ln;"
-       "  Out.Int(Factorial(8), 0); Out.Ln;"
-       "  Out.Int(Factorial(9), 0); Out.Ln;"
-       "  Out.Int(Factorial(10), 0); Out.Ln;"
-       "  Out.Int(Factorial(11), 0); Out.Ln;"
-       "  Out.Int(Factorial(12), 0); Out.Ln;"
-       "  Out.Int(Factorial(13), 0); Out.Ln;"
-       "  Out.Int(Factorial(14), 0); Out.Ln;"
+       "  Out.Ln;"
        "END Test."
 ;