DEADSOFTWARE

Добавлен оператор IS
[dsw-obn.git] / src / test.c
index a144f3616074e1f8891dbc30af0007420bad0ef9..024252a2def43abc44d82e38d95f1180f551caa2 100644 (file)
@@ -10,35 +10,22 @@ static char source_test[] =
        "IMPORT Out;"
        ""
        "TYPE"
-       "  R = INTEGER;"
+       "  RecA = POINTER TO RecADesc;"
+       "  RecADesc = RECORD END;"
        ""
-       "PROCEDURE Factorial(n : R) : R;"
-       "BEGIN"
-       "  IF n <= 1 THEN"
-       "    RETURN 1;"
-       "  ELSE"
-       "    RETURN n * Factorial(n - 1);"
-       "  END;"
-       "  RETURN 0; (* Детектор ретурнов - дерьмо *)"
-       "END Factorial;"
+       "  RecB = POINTER TO RecBDesc;"
+       "  RecBDesc = RECORD (RecADesc) END;"
+       ""
+       "VAR"
+       "  a : RecA;"
+       "  b : RecB;"
        ""
        "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;"
+       "  NEW(a);"
+       "  NEW(b);"
+       "  Out.Open;"
+       "  a := b;"
+       "  IF a IS RecA THEN Out.String('Yes'); Out.Ln; END;"
        "END Test."
 ;