codea: *.{1,2,3}er testfaelle der ag fuer codea uebernommen
authorBernhard Urban <lewurm@gmail.com>
Mon, 17 May 2010 23:20:47 +0000 (01:20 +0200)
committerBernhard Urban <lewurm@gmail.com>
Mon, 17 May 2010 23:20:47 +0000 (01:20 +0200)
54 files changed:
codea/ag_abgabe_x0.1 [new file with mode: 0644]
codea/ag_abgabe_x1.1 [new file with mode: 0644]
codea/ag_abgabe_x2.1 [new file with mode: 0644]
codea/ag_abgabe_x3.1 [new file with mode: 0644]
codea/ag_abgabe_y0.2 [new file with mode: 0644]
codea/ag_abgabe_y1.2 [new file with mode: 0644]
codea/ag_abgabe_y2.2 [new file with mode: 0644]
codea/ag_abgabe_y3.2 [new file with mode: 0644]
codea/ag_abgabe_y4.2 [new file with mode: 0644]
codea/ag_abgabe_y5.2 [new file with mode: 0644]
codea/ag_abgabe_y6.2 [new file with mode: 0644]
codea/ag_abgabe_y7.2 [new file with mode: 0644]
codea/ag_abgabe_y8.2 [new file with mode: 0644]
codea/ag_abgabe_y9.2 [new file with mode: 0644]
codea/ag_abgabe_z0.3 [new file with mode: 0644]
codea/ag_abgabe_za.3 [new file with mode: 0644]
codea/ag_abgabe_zb.3 [new file with mode: 0644]
codea/ag_abgabe_zc.3 [new file with mode: 0644]
codea/ag_abgabe_zd.3 [new file with mode: 0644]
codea/ag_abgabe_ze.3 [new file with mode: 0644]
codea/ag_abgabe_zf.3 [new file with mode: 0644]
codea/ag_abgabe_zg.3 [new file with mode: 0644]
codea/ag_abgabe_zh.3 [new file with mode: 0644]
codea/ag_abgabe_zi.3 [new file with mode: 0644]
codea/ag_abgabe_zj.3 [new file with mode: 0644]
codea/ag_adrixan_00.3 [new file with mode: 0644]
codea/ag_bschussek_00.3 [new file with mode: 0644]
codea/ag_bschussek_01.3 [new file with mode: 0644]
codea/ag_fieselschweif_00.3 [new file with mode: 0644]
codea/ag_fieselschweif_01.3 [new file with mode: 0644]
codea/ag_fieselschweif_02.3 [new file with mode: 0644]
codea/ag_lewurm_00.3 [new file with mode: 0644]
codea/ag_lewurm_01.3 [new file with mode: 0644]
codea/ag_lewurm_02.3 [new file with mode: 0644]
codea/ag_lewurm_06.3 [new file with mode: 0644]
codea/ag_nax_03.2 [new file with mode: 0644]
codea/ag_nax_05.2 [new file with mode: 0644]
codea/ag_nax_09.3 [new file with mode: 0644]
codea/ag_nax_12.3 [new file with mode: 0644]
codea/ag_nax_14.3 [new file with mode: 0644]
codea/ag_snafu_01.3 [new file with mode: 0644]
codea/ag_snafu_02.3 [new file with mode: 0644]
codea/ag_snafu_03.3 [new file with mode: 0644]
codea/ag_snafu_04.3 [new file with mode: 0644]
codea/ag_snafu_06.3 [new file with mode: 0644]
codea/ag_snafu_07.3 [new file with mode: 0644]
codea/ag_snafu_10.3 [new file with mode: 0644]
codea/ag_snafu_11.3 [new file with mode: 0644]
codea/ag_torotil_01.3 [new file with mode: 0644]
codea/ag_zzbsm17_01.3 [new file with mode: 0644]
codea/ag_zzbsm17_02.3 [new file with mode: 0644]
codea/ag_zzbsm17_03.3 [new file with mode: 0644]
codea/ag_zzbsm17_04.3 [new file with mode: 0644]
codea/ag_zzbsm17_06.3 [new file with mode: 0644]

diff --git a/codea/ag_abgabe_x0.1 b/codea/ag_abgabe_x0.1
new file mode 100644 (file)
index 0000000..397db75
--- /dev/null
@@ -0,0 +1 @@
+:
diff --git a/codea/ag_abgabe_x1.1 b/codea/ag_abgabe_x1.1
new file mode 100644 (file)
index 0000000..314d73b
--- /dev/null
@@ -0,0 +1 @@
+%
diff --git a/codea/ag_abgabe_x2.1 b/codea/ag_abgabe_x2.1
new file mode 100644 (file)
index 0000000..e931977
--- /dev/null
@@ -0,0 +1 @@
+/* unvollendet
diff --git a/codea/ag_abgabe_x3.1 b/codea/ag_abgabe_x3.1
new file mode 100644 (file)
index 0000000..5242dd2
--- /dev/null
@@ -0,0 +1 @@
+: =
diff --git a/codea/ag_abgabe_y0.2 b/codea/ag_abgabe_y0.2
new file mode 100644 (file)
index 0000000..1a59e1e
--- /dev/null
@@ -0,0 +1,2 @@
+method foo(x,y)
+end;
diff --git a/codea/ag_abgabe_y1.2 b/codea/ag_abgabe_y1.2
new file mode 100644 (file)
index 0000000..47588a5
--- /dev/null
@@ -0,0 +1,3 @@
+method x()
+  this:=x;
+end;
diff --git a/codea/ag_abgabe_y2.2 b/codea/ag_abgabe_y2.2
new file mode 100644 (file)
index 0000000..2d17a51
--- /dev/null
@@ -0,0 +1,3 @@
+method x()
+  x:=x-x*x;
+end;
diff --git a/codea/ag_abgabe_y3.2 b/codea/ag_abgabe_y3.2
new file mode 100644 (file)
index 0000000..9055bd9
--- /dev/null
@@ -0,0 +1,4 @@
+method x()
+  if x<x or x=x then
+  end;
+end;
diff --git a/codea/ag_abgabe_y4.2 b/codea/ag_abgabe_y4.2
new file mode 100644 (file)
index 0000000..f557d66
--- /dev/null
@@ -0,0 +1,3 @@
+method x()
+  x := x < x < x;
+end;
diff --git a/codea/ag_abgabe_y5.2 b/codea/ag_abgabe_y5.2
new file mode 100644 (file)
index 0000000..e310325
--- /dev/null
@@ -0,0 +1,3 @@
+method x()
+  x:=x(,x);
+end;
diff --git a/codea/ag_abgabe_y6.2 b/codea/ag_abgabe_y6.2
new file mode 100644 (file)
index 0000000..aeefe39
--- /dev/null
@@ -0,0 +1,3 @@
+method x()
+  var x.x:=x;
+end;
diff --git a/codea/ag_abgabe_y7.2 b/codea/ag_abgabe_y7.2
new file mode 100644 (file)
index 0000000..90dc0fc
--- /dev/null
@@ -0,0 +1,3 @@
+method x()
+  ;
+end;
diff --git a/codea/ag_abgabe_y8.2 b/codea/ag_abgabe_y8.2
new file mode 100644 (file)
index 0000000..81fc2fd
--- /dev/null
@@ -0,0 +1,3 @@
+method x()
+  x(x,,);
+end;
diff --git a/codea/ag_abgabe_y9.2 b/codea/ag_abgabe_y9.2
new file mode 100644 (file)
index 0000000..4860d8f
--- /dev/null
@@ -0,0 +1,3 @@
+method x()
+  x.this = x;
+end;
diff --git a/codea/ag_abgabe_z0.3 b/codea/ag_abgabe_z0.3
new file mode 100644 (file)
index 0000000..fd683e3
--- /dev/null
@@ -0,0 +1,3 @@
+method m()
+  return x;
+end;
diff --git a/codea/ag_abgabe_za.3 b/codea/ag_abgabe_za.3
new file mode 100644 (file)
index 0000000..2c63ceb
--- /dev/null
@@ -0,0 +1,2 @@
+method m(x x)
+end;
diff --git a/codea/ag_abgabe_zb.3 b/codea/ag_abgabe_zb.3
new file mode 100644 (file)
index 0000000..89447ea
--- /dev/null
@@ -0,0 +1,5 @@
+method m(x)
+  if x then
+    var x:=0;
+  end;
+end;
diff --git a/codea/ag_abgabe_zc.3 b/codea/ag_abgabe_zc.3
new file mode 100644 (file)
index 0000000..62b6d5c
--- /dev/null
@@ -0,0 +1,10 @@
+method m()
+  while this do
+    var x:=this;
+    if this then
+    else
+      var x:=this;
+    end;
+  end;
+end;
+
diff --git a/codea/ag_abgabe_zd.3 b/codea/ag_abgabe_zd.3
new file mode 100644 (file)
index 0000000..0a7b327
--- /dev/null
@@ -0,0 +1,4 @@
+struct
+  a
+  a
+end;
diff --git a/codea/ag_abgabe_ze.3 b/codea/ag_abgabe_ze.3
new file mode 100644 (file)
index 0000000..5a33a8b
--- /dev/null
@@ -0,0 +1,7 @@
+struct
+  a
+end;
+
+struct
+  a
+end;
diff --git a/codea/ag_abgabe_zf.3 b/codea/ag_abgabe_zf.3
new file mode 100644 (file)
index 0000000..b98f794
--- /dev/null
@@ -0,0 +1,7 @@
+method m()
+  if this then
+    var x:=this;
+  else
+    return x;
+  end;
+end;
diff --git a/codea/ag_abgabe_zg.3 b/codea/ag_abgabe_zg.3
new file mode 100644 (file)
index 0000000..16c09e1
--- /dev/null
@@ -0,0 +1,4 @@
+method m()
+  x:=this;
+  var x:=0;
+end;
diff --git a/codea/ag_abgabe_zh.3 b/codea/ag_abgabe_zh.3
new file mode 100644 (file)
index 0000000..d5109fc
--- /dev/null
@@ -0,0 +1,7 @@
+method m()
+  a:=this;
+end;
+
+struct
+  a
+end;
diff --git a/codea/ag_abgabe_zi.3 b/codea/ag_abgabe_zi.3
new file mode 100644 (file)
index 0000000..e78de1a
--- /dev/null
@@ -0,0 +1,3 @@
+method m()
+  var x:=x;
+end;
diff --git a/codea/ag_abgabe_zj.3 b/codea/ag_abgabe_zj.3
new file mode 100644 (file)
index 0000000..1ce58c2
--- /dev/null
@@ -0,0 +1,3 @@
+method m(x)
+  return this.x;
+end;
diff --git a/codea/ag_adrixan_00.3 b/codea/ag_adrixan_00.3
new file mode 100644 (file)
index 0000000..d38991d
--- /dev/null
@@ -0,0 +1,10 @@
+struct a d end;
+method f(b c s)
+       var t := 0;
+       /* lesender feldzugriff */
+       b := c*(s.a - 1);
+       b := c*(s.d - 1);
+       b := c*(t.a - 1);
+       /* Zusatz zu lewurm_05.0: ung├╝ltig, da c keine Feldvariable ist */
+       b := c*(t.c - 1);
+end;
diff --git a/codea/ag_bschussek_00.3 b/codea/ag_bschussek_00.3
new file mode 100644 (file)
index 0000000..fc50d8c
--- /dev/null
@@ -0,0 +1,5 @@
+method test(arg1)
+    arg1.a := 10; /* undefined field */
+end;
+
+struct a end;
diff --git a/codea/ag_bschussek_01.3 b/codea/ag_bschussek_01.3
new file mode 100644 (file)
index 0000000..86b8caa
--- /dev/null
@@ -0,0 +1,5 @@
+method test(arg1)
+       var b := arg1.a; /* undefined field */
+end;
+
+struct a end;
diff --git a/codea/ag_fieselschweif_00.3 b/codea/ag_fieselschweif_00.3
new file mode 100644 (file)
index 0000000..63e264b
--- /dev/null
@@ -0,0 +1,5 @@
+/* multiple field definition on "doubletrouble" here */
+struct doubletrouble foo end;
+method test(a b c)
+end;
+struct bar doubletrouble end;
diff --git a/codea/ag_fieselschweif_01.3 b/codea/ag_fieselschweif_01.3
new file mode 100644 (file)
index 0000000..2c126cf
--- /dev/null
@@ -0,0 +1,3 @@
+/* multiple variable definition in param list */
+method test(a b c a)
+end;
diff --git a/codea/ag_fieselschweif_02.3 b/codea/ag_fieselschweif_02.3
new file mode 100644 (file)
index 0000000..8b0c25d
--- /dev/null
@@ -0,0 +1,6 @@
+/* fieldnames are NOT visible everywhere, but only after their definition */
+method foobar(a)
+       a.youdontseemeyet := 31337;
+end;
+
+struct youdontseemeyet end;
diff --git a/codea/ag_lewurm_00.3 b/codea/ag_lewurm_00.3
new file mode 100644 (file)
index 0000000..25e8e2f
--- /dev/null
@@ -0,0 +1,6 @@
+method f(a b c)
+       /* x nicht deklariert */
+       if a < x then
+               c := 0x1;
+       end;
+end;
diff --git a/codea/ag_lewurm_01.3 b/codea/ag_lewurm_01.3
new file mode 100644 (file)
index 0000000..eda05e0
--- /dev/null
@@ -0,0 +1,8 @@
+method f(a b c)
+       if a < b then
+               var x := 0;
+               c := 1;
+       end;
+       /* x ist nicht im scope */
+       x := x - 1;
+end;
diff --git a/codea/ag_lewurm_02.3 b/codea/ag_lewurm_02.3
new file mode 100644 (file)
index 0000000..c5fc09a
--- /dev/null
@@ -0,0 +1,4 @@
+method f(a b c)
+       /* x ist (noch) nicht im scope */
+       var x := x - 1;
+end;
diff --git a/codea/ag_lewurm_06.3 b/codea/ag_lewurm_06.3
new file mode 100644 (file)
index 0000000..2b44db2
--- /dev/null
@@ -0,0 +1,5 @@
+method f(b)
+       var t := 0;
+       /* identifier doppelt vorhanden */
+       var b := 0;
+end;
diff --git a/codea/ag_nax_03.2 b/codea/ag_nax_03.2
new file mode 100644 (file)
index 0000000..9a78b21
--- /dev/null
@@ -0,0 +1,2 @@
+struct mystruct
+end
diff --git a/codea/ag_nax_05.2 b/codea/ag_nax_05.2
new file mode 100644 (file)
index 0000000..fc6fb9e
--- /dev/null
@@ -0,0 +1,3 @@
+method testit()
+    var b := 10 - d * 20;       /* should raise an error, since '(' ')' are missing */
+end;
diff --git a/codea/ag_nax_09.3 b/codea/ag_nax_09.3
new file mode 100644 (file)
index 0000000..f78e9ec
--- /dev/null
@@ -0,0 +1,7 @@
+method abc(arg1 arg2)
+    if arg1 = arg2 then
+        var a := 42;
+    end;
+    
+    var b := a - -1;
+end;
diff --git a/codea/ag_nax_12.3 b/codea/ag_nax_12.3
new file mode 100644 (file)
index 0000000..4ee7a1b
--- /dev/null
@@ -0,0 +1,6 @@
+struct a b c end;
+method test(arg1 arg2)
+    arg1.a := 10;
+end;
+
+struct c d e end;
diff --git a/codea/ag_nax_14.3 b/codea/ag_nax_14.3
new file mode 100644 (file)
index 0000000..7174855
--- /dev/null
@@ -0,0 +1,3 @@
+method abc(arg1 arg2)
+    var arg2 := 10; /* detect duplicates and fail */
+end;
diff --git a/codea/ag_snafu_01.3 b/codea/ag_snafu_01.3
new file mode 100644 (file)
index 0000000..17ab765
--- /dev/null
@@ -0,0 +1,32 @@
+struct
+       a b c
+end;
+
+method bar(d e f)
+       var foo := a;
+       foo := b - c;
+       var bar := d - (e * f);
+       
+       if(4 = 2) then
+               var x := 1;
+               var hiho := 0;
+       else
+               var hiho := 0x1f;
+       end;
+
+       var hiho := 2;
+
+       while 0 < hiho do
+               if (42) then
+                       var hiho := 0xff; /* hiho existiert bereits */
+                       hiho := hiho - 1;
+               end;
+       end;
+       
+       return 0;
+end;
+
+struct
+       g
+       h
+end;
diff --git a/codea/ag_snafu_02.3 b/codea/ag_snafu_02.3
new file mode 100644 (file)
index 0000000..a114c97
--- /dev/null
@@ -0,0 +1,33 @@
+struct
+       a b c
+end;
+
+method bar(d e f)
+       var foo := a;
+       foo := b - c;
+       var bar := d - (e * f);
+       
+       if(4 = 2) then
+               var x := 1;
+               var hiho := 0;
+       else
+               var hiho := 0x1f;
+       end;
+
+       var hiho := 2;
+
+       while 0 < hiho do
+               if (42) then
+                       hiho := hiho - 1;
+               else
+                       hiho := hiho - (0 - g); /* g existiert noch nicht */
+               end;
+       end;
+       
+       return 0;
+end;
+
+struct
+       g
+       h
+end;
diff --git a/codea/ag_snafu_03.3 b/codea/ag_snafu_03.3
new file mode 100644 (file)
index 0000000..fd67059
--- /dev/null
@@ -0,0 +1,34 @@
+struct
+       a b c
+end;
+
+method bar(d e f)
+       var foo := a;
+       foo := b - c;
+       var bar := d - (e * f);
+       
+       if(4 = 2) then
+               var x := 1;
+               var hiho := 0;
+       else
+               var hiho := 0x1f;
+       end;
+
+       var hiho := 2;
+
+       while 0 < hiho do
+               if (42) then
+                       hiho := hiho - 1;
+               else
+                       hiho := hiho - (0 - a);
+               end;
+       end;
+
+       var e := 22; /* e existiert bereits */  
+       return 0;
+end;
+
+struct
+       g
+       h
+end;
diff --git a/codea/ag_snafu_04.3 b/codea/ag_snafu_04.3
new file mode 100644 (file)
index 0000000..ea5c6a8
--- /dev/null
@@ -0,0 +1,30 @@
+struct
+       a b c
+end;
+
+method bar(d e f)
+       var foo := a;
+       foo := b - c;
+       var bar := d - (e * f);
+       
+       if(4 = 2) then
+               var x := 1;
+               var hiho := 0;
+       else
+               var hiho := 0x1f;
+       end;
+
+       if(9 < 8) then
+               var hohi := 12;
+       else
+               var hiho := 2;
+       end;
+
+
+       return hiho; /* hiho existiert nicht */
+end;
+
+struct
+       g
+       h
+end;
diff --git a/codea/ag_snafu_06.3 b/codea/ag_snafu_06.3
new file mode 100644 (file)
index 0000000..e4fa6e8
--- /dev/null
@@ -0,0 +1,9 @@
+struct g1 g2 g3 g4 end;
+struct g5 g6 end;
+
+method foo(p1 p2 p3)
+       var l1 := 0;
+       var l2 := g6;
+
+       g1.g2.l1 := 0xDEAD; /* l1 kein feld */
+end;
diff --git a/codea/ag_snafu_07.3 b/codea/ag_snafu_07.3
new file mode 100644 (file)
index 0000000..8de0724
--- /dev/null
@@ -0,0 +1,9 @@
+struct g1 g2 g3 g4 end;
+struct g5 g6 end;
+
+method foo(p1 p2 p3)
+       var l1 := 0;
+       var l2 := g6;
+
+       g1.g2.p1 := 0xDEAD; /* p1 kein feld */
+end;
diff --git a/codea/ag_snafu_10.3 b/codea/ag_snafu_10.3
new file mode 100644 (file)
index 0000000..fa7e897
--- /dev/null
@@ -0,0 +1,9 @@
+struct g1 g2 g3 g4 end;
+struct g5 g6 end;
+
+method foo(p1 p2 p3)
+       var l1 := 0;
+       var l2 := g6;
+
+       g1.l2.g2 := 0xDEAD; /* l2 kein feld */
+end;
diff --git a/codea/ag_snafu_11.3 b/codea/ag_snafu_11.3
new file mode 100644 (file)
index 0000000..6456a50
--- /dev/null
@@ -0,0 +1,9 @@
+struct g1 g2 g3 g4 end;
+struct g5 g6 end;
+
+method foo(p1 p2 p3)
+       var l1 := 0;
+       var l2 := g6;
+
+       g1.p3.g6:= 0xDEAD; /* p3 kein feld */
+end;
diff --git a/codea/ag_torotil_01.3 b/codea/ag_torotil_01.3
new file mode 100644 (file)
index 0000000..84d6480
--- /dev/null
@@ -0,0 +1,9 @@
+struct 
+    one struct_not defined
+end;
+
+method main(a b)
+   var something := 0x42;
+   var the := 0x42;
+   the.one.missing_struct := something;
+end;
diff --git a/codea/ag_zzbsm17_01.3 b/codea/ag_zzbsm17_01.3
new file mode 100644 (file)
index 0000000..7ce046a
--- /dev/null
@@ -0,0 +1,7 @@
+method foo ( )
+    if 1 then
+        var v1 := 1;
+    else
+        v1 := 2;
+    end;
+end;
diff --git a/codea/ag_zzbsm17_02.3 b/codea/ag_zzbsm17_02.3
new file mode 100644 (file)
index 0000000..791203d
--- /dev/null
@@ -0,0 +1,3 @@
+method foo ( p1 )
+    var p1 := 1;
+end;
diff --git a/codea/ag_zzbsm17_03.3 b/codea/ag_zzbsm17_03.3
new file mode 100644 (file)
index 0000000..23be7ba
--- /dev/null
@@ -0,0 +1,7 @@
+method foo ( )
+    if 1 then
+        var v1 := 1;
+    end;
+
+    return v1;
+end;
diff --git a/codea/ag_zzbsm17_04.3 b/codea/ag_zzbsm17_04.3
new file mode 100644 (file)
index 0000000..5b021fc
--- /dev/null
@@ -0,0 +1,5 @@
+method foo ( )
+    v1 := 1;
+    var v1 := 1;
+    return v1;
+end;
diff --git a/codea/ag_zzbsm17_06.3 b/codea/ag_zzbsm17_06.3
new file mode 100644 (file)
index 0000000..6d17fd3
--- /dev/null
@@ -0,0 +1,16 @@
+struct f1 end;
+
+method foo ( )
+    
+    var v1 := 1;
+
+    /* Bei einem Variablen/Feldzugriff muss eine Variable oder ein Feld mit dem Namen sichtbar sein */
+    f1 := f1;
+    v1 := v1;
+
+    /* Bei einem Feldzugriff muss ein Feld mit dem Namen sichtbar sein */
+    this.f1 := this.f1;
+    this.v1 := this.v1;
+
+    return v1;
+end;