]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
This fuzzer now outputs lots of files to the current directory.
authortrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 11 Sep 2011 12:44:55 +0000 (12:44 +0000)
committertrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 11 Sep 2011 12:44:55 +0000 (12:44 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1394 e59a4935-1847-0410-ae03-e826735625c1

tests/generated_tests/ArrayGenerator.java

index 42c442737c5faca419b5bdad6f48af613d189ac7..8c7fe62d680d5f631b8e0b5e3e2a42f8a2dc9cd8 100644 (file)
@@ -1,12 +1,13 @@
 import java.util.ArrayList;\r
 import java.util.List;\r
 import java.util.Random;\r
+import java.io.*;\r
 \r
 /* Randomly generates problem instances that contain nested array operations */\r
 \r
 // Both Indexes and values have the same bitwidth, potentially missing some errors.\r
 \r
-// Doesn't generate extensional problems yet..\r
+// Doesn't generate extensional problems!\r
 \r
 public class ArrayGenerator\r
 {\r
@@ -15,8 +16,9 @@ public class ArrayGenerator
     static Random r = new Random();\r
 \r
     static int MAX_DEPTH;\r
+    static int numberOfInstances = 500;\r
 \r
-    public static void main(String[] args)\r
+    public static void main(String[] args) throws IOException\r
     {\r
        bits.add("b1");\r
        bits.add("b2");\r
@@ -26,13 +28,18 @@ public class ArrayGenerator
        arrays.add("a2");\r
        arrays.add("a3");\r
 \r
-       // When we get to the nesting depth, start to return leaf nodes (like symbols).\r
-       MAX_DEPTH = r.nextInt(15) +1;\r
 \r
-       randomGenerate();\r
-    }\r
+       for (int i=0; i < numberOfInstances; i++)\r
+       {\r
+               // When we get to the nesting depth, start to return leaf nodes (like symbols).\r
+               MAX_DEPTH = r.nextInt(15) +1;\r
 \r
-    static void randomGenerate()\r
+               randomGenerate("f"+i+".smt");\r
+    \r
+       }\r
+}\r
+\r
+    static void randomGenerate(String fileName) throws IOException\r
     {\r
        StringBuilder output = new StringBuilder();\r
        output.append("(\n");\r
@@ -56,7 +63,12 @@ public class ArrayGenerator
            output.append(":assumption " + generateProp(0) + "\n");\r
 \r
        output.append(":formula true \n )\n");\r
-       System.out.println(output);\r
+       \r
+       FileWriter fstream = new FileWriter(fileName);\r
+         BufferedWriter out = new BufferedWriter(fstream);\r
+         out.write(output.toString());\r
+         out.close();\r
+\r
     }\r
 \r
     // Arrays are either array symbols, ites, or stores.\r