added some testcases for ag
authorMichael Opitz <u0828257@g0.complang.tuwien.ac.at>
Wed, 31 Mar 2010 12:40:29 +0000 (14:40 +0200)
committerMichael Opitz <u0828257@g0.complang.tuwien.ac.at>
Wed, 31 Mar 2010 12:40:29 +0000 (14:40 +0200)
14 files changed:
ag/nax_00.0 [new file with mode: 0644]
ag/nax_01.0 [new file with mode: 0644]
ag/nax_02.0 [new file with mode: 0644]
ag/nax_03.2 [new file with mode: 0644]
ag/nax_04.0 [new file with mode: 0644]
ag/nax_05.2 [new file with mode: 0644]
ag/nax_06.0 [new file with mode: 0644]
ag/nax_07.0 [new file with mode: 0644]
ag/nax_08.0 [new file with mode: 0644]
ag/nax_09.3 [new file with mode: 0644]
ag/nax_10.0 [new file with mode: 0644]
ag/nax_11.0 [new file with mode: 0644]
ag/nax_12.3 [new file with mode: 0644]
ag/nax_14.3 [new file with mode: 0644]

diff --git a/ag/nax_00.0 b/ag/nax_00.0
new file mode 100644 (file)
index 0000000..62d4d11
--- /dev/null
@@ -0,0 +1,10 @@
+struct 
+    x y z
+end;
+
+method f(a b c)
+    /* sollte funktionieren (zugriff auf this.x) */
+    var n := x;
+    return n;
+end;
+
diff --git a/ag/nax_01.0 b/ag/nax_01.0
new file mode 100644 (file)
index 0000000..f579a41
--- /dev/null
@@ -0,0 +1,15 @@
+struct mystruct
+    field1
+    field2
+    field3
+end;
+method doit()
+    var a := 10000;
+    var b := 0x42;
+
+    return a - (b * 100);
+end;
+
+method tester(arg)
+    doit();
+end;
diff --git a/ag/nax_02.0 b/ag/nax_02.0
new file mode 100644 (file)
index 0000000..a335fe6
--- /dev/null
@@ -0,0 +1,8 @@
+method with_args2(arg1 arg2)
+    var a := 0;
+    doit();
+    another_stmt();
+    a;
+    something();
+    something_other(arg1,);
+end;
diff --git a/ag/nax_03.2 b/ag/nax_03.2
new file mode 100644 (file)
index 0000000..9a78b21
--- /dev/null
@@ -0,0 +1,2 @@
+struct mystruct
+end
diff --git a/ag/nax_04.0 b/ag/nax_04.0
new file mode 100644 (file)
index 0000000..67a0c34
--- /dev/null
@@ -0,0 +1,6 @@
+/* 
+    Hi,
+     this is a very long comment with some keywords which should be eaten 
+    struct struct
+    struct
+*/
diff --git a/ag/nax_05.2 b/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/ag/nax_06.0 b/ag/nax_06.0
new file mode 100644 (file)
index 0000000..146d79a
--- /dev/null
@@ -0,0 +1,25 @@
+struct person
+    first_name
+    last_name
+end;
+
+method doit(person)
+    person.print_names(person.first_name, person.last_name,);
+end;
+
+method print_names(arg1 arg2)
+    if arg1 = arg2 then
+        this.print(arg1);
+        return 1;
+    end;
+    this.print(arg1);
+    this.print(arg2);
+    var a := 0;
+    a := (1 - 0x3).to_f();
+
+    if 1 then
+        print(a);
+    else
+        print(0); /* never reached */
+    end;
+end;
diff --git a/ag/nax_07.0 b/ag/nax_07.0
new file mode 100644 (file)
index 0000000..257a7a3
--- /dev/null
@@ -0,0 +1,21 @@
+struct 
+    dots per line should be allowed some other 
+end;
+
+method doit(a b)
+    while a < b do
+        var something := 0x42;
+        var many := 0x42;
+        var and := 0x42;
+        while a = b do
+            the_end();
+        end;
+        if something then
+            doit();
+        else if not something then end;
+        end;
+
+        many.dots.per.line.should.be.allowed := and.some.other.dots;
+
+    end;
+end;
diff --git a/ag/nax_08.0 b/ag/nax_08.0
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/ag/nax_09.3 b/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/ag/nax_10.0 b/ag/nax_10.0
new file mode 100644 (file)
index 0000000..f187306
--- /dev/null
@@ -0,0 +1,10 @@
+method test_nested_ifs(arg1 arg2)
+    if arg1 = arg2 then
+        var a := 1;
+    end;
+
+    if not (arg1 = arg2) then
+        var a := 2;
+        var b := a - -1;
+    end;
+end;
diff --git a/ag/nax_11.0 b/ag/nax_11.0
new file mode 100644 (file)
index 0000000..96058a2
--- /dev/null
@@ -0,0 +1,9 @@
+method abc(arg1 arg2)
+    if arg1 = arg2 then
+        var a := 42;
+    end;
+    
+    var a := 3;
+    var b := a - -1;
+end;
+
diff --git a/ag/nax_12.3 b/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/ag/nax_14.3 b/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;