Test cases
authorbdemsky <bdemsky>
Fri, 28 Jul 2006 18:34:00 +0000 (18:34 +0000)
committerbdemsky <bdemsky>
Fri, 28 Jul 2006 18:34:00 +0000 (18:34 +0000)
Robust/src/Tests/Array.java
Robust/src/Tests/Array2.java [new file with mode: 0644]
Robust/src/Tests/BoundsFail.java [new file with mode: 0644]
Robust/src/Tests/BoundsFail2.java [new file with mode: 0644]
Robust/src/Tests/BoundsFail3.java [new file with mode: 0644]
Robust/src/Tests/BoundsFail4.java [new file with mode: 0644]
Robust/src/Tests/DoTests [new file with mode: 0755]
Robust/src/Tests/Test.java
Robust/src/Tests/While.java [new file with mode: 0644]
Robust/src/Tests/dotest [new file with mode: 0755]
Robust/src/Tests/virtualcalltest.java

index 6fb794785c57e8409bce8ddc01c40f1e647ec3e9..7a272d0dd34c6fbf52d75fd1abcf66cf83a24173 100644 (file)
@@ -5,6 +5,8 @@ public class Array {
        int i=2;
        a[i]=4;
        System.printInt(a[2]);
+       System.printString("\n");
        System.printInt(a.length);
+       System.printString("\n");
     }
 }
diff --git a/Robust/src/Tests/Array2.java b/Robust/src/Tests/Array2.java
new file mode 100644 (file)
index 0000000..37b0a27
--- /dev/null
@@ -0,0 +1,19 @@
+public class Array2 {
+    int a;
+    public static void main() {
+       int a[][]=new int[10][20];
+       for(int i=0;i<10;i++) {
+           for(int j=0;j<20;j++) {
+               a[i][j]=i*100+j;
+           }
+       }
+
+       for(int i=0;i<10;i++) {
+           for(int j=0;j<20;j++) {
+               System.printInt(a[i][j]);
+               System.printString(" ");
+           }
+           System.printString("\n");
+       }
+    }
+}
diff --git a/Robust/src/Tests/BoundsFail.java b/Robust/src/Tests/BoundsFail.java
new file mode 100644 (file)
index 0000000..b836789
--- /dev/null
@@ -0,0 +1,7 @@
+public class BoundsFail {
+    int a;
+    public static void main() {
+       int a[]=new int[10];
+       a[-1]=2;
+    }
+}
diff --git a/Robust/src/Tests/BoundsFail2.java b/Robust/src/Tests/BoundsFail2.java
new file mode 100644 (file)
index 0000000..98ac0ec
--- /dev/null
@@ -0,0 +1,7 @@
+public class BoundsFail2 {
+    int a;
+    public static void main() {
+       int a[]=new int[10];
+       a[10]=2;
+    }
+}
diff --git a/Robust/src/Tests/BoundsFail3.java b/Robust/src/Tests/BoundsFail3.java
new file mode 100644 (file)
index 0000000..b439d46
--- /dev/null
@@ -0,0 +1,7 @@
+public class BoundsFail3 {
+    int a;
+    public static void main() {
+       int a[]=new int[10];
+       int b=a[-1];
+    }
+}
diff --git a/Robust/src/Tests/BoundsFail4.java b/Robust/src/Tests/BoundsFail4.java
new file mode 100644 (file)
index 0000000..0af6e60
--- /dev/null
@@ -0,0 +1,7 @@
+public class BoundsFail4 {
+    int a;
+    public static void main() {
+       int a[]=new int[10];
+       int b=a[10];
+    }
+}
diff --git a/Robust/src/Tests/DoTests b/Robust/src/Tests/DoTests
new file mode 100755 (executable)
index 0000000..1b2356b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+export PATH=$PATH:./
+dotest Array Array.java
+dotest Array2 Array2.java
+dotest BoundsFail BoundsFail.java
+dotest BoundsFail2 BoundsFail2.java
+dotest BoundsFail3 BoundsFail3.java
+dotest BoundsFail4 BoundsFail4.java
+dotest StringTest StringTest.java
+dotest Test Test.java
+dotest virtualcalltest virtualcalltest.java
index 7b2b6fc4f8bc6c954154cb4c62039c41bc89e4f7..09fc88cc148d2dc534713ed43c6b06b70af4c115 100644 (file)
@@ -5,14 +5,16 @@ public class Test {
     int a;
     public static void main() {
        Test t=new Test();
-       for(int i=3;i<100000;i++) {
+       for(int i=3;i<10000;i++) {
                boolean flag=true;
                for(int j=2;flag&&j<i;j++) {
                        if ((i%j)==0)
                             flag=false;
                }
-//             if (flag)
-//                     System.printInt(i);
+               if (flag) {
+                       System.printInt(i);
+                       System.printString("\n");
+               }
        }
     }
 }
diff --git a/Robust/src/Tests/While.java b/Robust/src/Tests/While.java
new file mode 100644 (file)
index 0000000..973b274
--- /dev/null
@@ -0,0 +1,7 @@
+public class While {
+    public static void main() {
+       while(true) {
+           i++;
+       }
+    }
+}
diff --git a/Robust/src/Tests/dotest b/Robust/src/Tests/dotest
new file mode 100755 (executable)
index 0000000..a57f1d9
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+echo Doing Test $1
+../buildscript $1 $2 &>/dev/null
+$1.bin &> output/$1.output
+diff output/$1.output output/$1.output.goal
+rm $1.bin
index 249c0f8b22e824d13acff37ed5ffd6366d23dc16..0996eef54f71d13cdd89b02ae281118c61458b8b 100644 (file)
@@ -5,6 +5,7 @@ class A {
 
    void foo(int x) {
        System.printInt(x);
+       System.printString("\n");
    }
 }
 
@@ -34,7 +35,7 @@ public class virtualcalltest {
        A a=null;
        B b=new B();
        C c=new C();
-       for(int i=0;i<100000000;i++) {
+       for(int i=0;i<1000000;i++) {
                if (i%2==0)
                        a=b;
                else