DEADSOFTWARE

Что-то там тестировалось с массивами...
[dsw-obn.git] / test.c
diff --git a/test.c b/test.c
index 42526b66791c035ca854e2221050f26eeac893e5..432307f51ba6e983b25400f43e593e2e8e555fdf 100644 (file)
--- a/test.c
+++ b/test.c
@@ -1,51 +1,32 @@
 #include "oberon.h"
+#include "generator.h"
 #include <assert.h>
 
 static const char source[] =
        "MODULE Test;"
-       "CONST"
-       "       con = 3;"
-       ""
        "TYPE"
-       "       MyInt = INTEGER;"
-       "       MyArr = ARRAY con OF MyInt;"
-       "       MyRec = RECORD a : MyInt; b : MyInt; END;"
-       "       MyProc = PROCEDURE;"
-       ""
+       "       Int = INTEGER;"
+       "       PArray2D = POINTER TO Array2D;"
+       "       Array2D = ARRAY 3 OF ARRAY 3 OF INTEGER;"
+       "       PAP2D = ARRAY 4 OF POINTER TO ARRAY 5 OF INTEGER;"
+       "       Object = POINTER TO ObjectDesc;"
+       "       ObjectDesc = RECORD"
+       "               value : Array2D;"
+       "               value2 : PArray2D;"
+       "               doStuff : Proc;"
+       "               next : Object;"
+       "       END;"
+       "       Proc = PROCEDURE(self : Object; i : Int);"
        "VAR"
-       "       k : INTEGER;"
-       "       i : INTEGER;"
-       "       b : BOOLEAN;"
-       "       arr : MyArr;"
-       "       rec : MyRec;"
-       "       proc : MyProc;"
-       ""
-       "PROCEDURE Tier;"
-       "BEGIN"
-       "       k := 314 + con;"
-       "END Tier;"
-       ""
-       "PROCEDURE Tier2(x : INTEGER; y : INTEGER);"
-       "BEGIN"
-       "       k := x + y;"
-       "END Tier2;"
-       ""
-       "PROCEDURE Tier3(x : INTEGER) : INTEGER;"
-       "BEGIN"
-       "       RETURN x * x * x;"
-       "END Tier3;"
-       ""
-       "BEGIN"
-       "       k := 1;"
-       "       i := k;"
-       "       b := (TRUE # FALSE);"
-       "       Tier();"
-       "       Tier2(21, 13);"
-       "       k := Tier3(2);"
-       "       arr[0] := 1;"
-       "       arr[1] := arr[0];"
-       "       rec.a := 1;"
-       "       rec.b := rec.a;"
+       "       i : Int;"
+       "       a2 : Array2D;"
+       "       p2 : PArray2D;"
+       "       po : Object;"
+       "       do : ObjectDesc;"
+       "       stuffProc : Proc;"
+       "       pap2 : PAP2D;"
+       "       "
+       "BEGIN;"
        "END Test."
 ;
 
@@ -58,6 +39,7 @@ main(int argc, char ** argv)
        ctx = oberon_create_context();
        mod = oberon_compile_module(ctx, source);
        //mod -> begin();
+       oberon_generator_dump(ctx, "dump.txt");
        oberon_destroy_context(ctx);
        return 0;
 }