Testcase generation tool for combinatorial interaction testing
Revision | 8a74ddaed8b64ede9d3608c955e0f96862c58588 (tree) |
---|---|
Time | 2018-07-27 13:35:25 |
Author | Tatsuhiro Tsuchiya <t-tutiya@ist....> |
Commiter | Tatsuhiro Tsuchiya |
Create new program to find forbidden pairs
@@ -1,7 +1,11 @@ | ||
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <classpath> |
3 | 3 | <classpathentry kind="src" path="src"/> |
4 | - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> | |
4 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> | |
5 | + <attributes> | |
6 | + <attribute name="module" value="true"/> | |
7 | + </attributes> | |
8 | + </classpathentry> | |
5 | 9 | <classpathentry kind="lib" path="lib/jdd_104.jar"/> |
6 | 10 | <classpathentry kind="output" path="bin"/> |
7 | 11 | </classpath> |
@@ -1,6 +1,6 @@ | ||
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | 2 | <projectDescription> |
3 | - <name>IPOG_bach</name> | |
3 | + <name>cit_bach</name> | |
4 | 4 | <comment></comment> |
5 | 5 | <projects> |
6 | 6 | </projects> |
@@ -10,11 +10,11 @@ Disk2 (SDD HDD) | ||
10 | 10 | {OS Disk} { Disk CPU} |
11 | 11 | |
12 | 12 | # §ñ(Ö¥)ðñ |
13 | -(if (and (== [] 8GB) (== [Disk] HDD) ) (or (== Vista [OS]) (<> [OS] Windows7) (<> [Disk] [Disk2]) )) | |
13 | +# (if (and (== [] 8GB) (== [Disk] HDD) ) (or (== Vista [OS]) (<> [OS] Windows7) (<> [Disk] [Disk2]) )) | |
14 | 14 | |
15 | -(ite (== [Disk] [Disk2]) (== [] 4GB) (<> [] 2GB)) | |
15 | +# (ite (== [Disk] [Disk2]) (== [] 4GB) (<> [] 2GB)) | |
16 | 16 | |
17 | -(and (not (and (<> [OS] Windows7_64) (== 8GB []))) (or (<> [OS] []) (<> 4GB []) (== [Disk] [CPU] ))) | |
17 | +# (and (not (and (<> [OS] Windows7_64) (== 8GB []))) (or (<> [OS] []) (<> 4GB []) (== [Disk] [CPU] ))) | |
18 | 18 | |
19 | 19 | # PZqFnot |
20 | 20 | # QZqF==C<>, if |
@@ -7,7 +7,7 @@ import java.util.Collections; | ||
7 | 7 | import java.util.List; |
8 | 8 | import java.util.TreeSet; |
9 | 9 | |
10 | -class ConstraintHandler { | |
10 | +public class ConstraintHandler { | |
11 | 11 | static final int sizeOfNodetable = 10000; |
12 | 12 | static final int sizeOfCache = 10000; |
13 | 13 |
@@ -34,7 +34,7 @@ class ConstraintHandler { | ||
34 | 34 | |
35 | 35 | |
36 | 36 | // With constrainedParameters BDD is reduced by excluding irrelevant parameters |
37 | - ConstraintHandler(PList parameterList, List<Node> constraintList, TreeSet<Integer> constrainedParameters) { | |
37 | + public ConstraintHandler(PList parameterList, List<Node> constraintList, TreeSet<Integer> constrainedParameters) { | |
38 | 38 | bdd = new BDD(sizeOfNodetable, sizeOfCache); |
39 | 39 | // bdd = new jdd.bdd.debug.DebugBDD(1000,1000); |
40 | 40 |
@@ -227,7 +227,7 @@ class ConstraintHandler { | ||
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - boolean isPossible(Testcase test) { | |
230 | + public boolean isPossible(Testcase test) { | |
231 | 231 | int node = bddConstraint; |
232 | 232 | boolean[] bv = binarizeReduced(test); |
233 | 233 |
@@ -10,11 +10,11 @@ public class Error { | ||
10 | 10 | // default ÅG[ÍWoÍ |
11 | 11 | static String filename = null; |
12 | 12 | |
13 | - static void setOutputFile(String filename) { | |
13 | + public static void setOutputFile(String filename) { | |
14 | 14 | Error.filename = filename; |
15 | 15 | } |
16 | 16 | |
17 | - static void printError(String str) { | |
17 | + public static void printError(String str) { | |
18 | 18 | BufferedWriter writer; |
19 | 19 | try { |
20 | 20 | if (filename == null) { |
@@ -182,7 +182,7 @@ public class Inputer { | ||
182 | 182 | return tokenList; |
183 | 183 | } |
184 | 184 | |
185 | - static InputFileData readModel(String filename) { | |
185 | + public static InputFileData readModel(String filename) { | |
186 | 186 | |
187 | 187 | BufferedReader reader = openFile(filename); |
188 | 188 | List<String> tokenList = makeTokenList(reader); |
@@ -30,7 +30,7 @@ public class Main { | ||
30 | 30 | public static void main(String[] args) { |
31 | 31 | |
32 | 32 | long start = System.currentTimeMillis(); |
33 | - | |
33 | + | |
34 | 34 | try { |
35 | 35 | // R}hø |
36 | 36 | String errorMessage = processCommandArgument(args); |
@@ -48,7 +48,7 @@ public class Main { | ||
48 | 48 | |
49 | 49 | // §ñ BDDì¬ |
50 | 50 | // System.err.println("starting building bdd"); |
51 | - | |
51 | + | |
52 | 52 | // old version where all parameters are considered in BDD |
53 | 53 | // ConstraintHandler conhndl = new ConstraintHandler( |
54 | 54 | // inputfiledata.parameterList, inputfiledata.constraintList); |
@@ -74,7 +74,7 @@ public class Main { | ||
74 | 74 | Error.printError(Main.language == Main.Language.JP ? "eXgP[XªãÀ" |
75 | 75 | + Generator.MaxNumOfTestcases + "ð´¦Üµ½" |
76 | 76 | : "The number of test cases exceeded the upper bound " |
77 | - + Generator.MaxNumOfTestcases); | |
77 | + + Generator.MaxNumOfTestcases); | |
78 | 78 | } |
79 | 79 | |
80 | 80 | new Outputer(outputFile).outputResult(testSet, inputfiledata, |
@@ -125,7 +125,7 @@ public class Main { | ||
125 | 125 | Error.printError(Main.language == Main.Language.JP ? "eXgP[XªãÀ" |
126 | 126 | + Generator.MaxNumOfTestcases + "ð´¦Üµ½" |
127 | 127 | : "The number of test cases exceeded the upper bound " |
128 | - + Generator.MaxNumOfTestcases); | |
128 | + + Generator.MaxNumOfTestcases); | |
129 | 129 | |
130 | 130 | new Outputer(outputFile).outputResult(testSet, inputfiledata, |
131 | 131 | randomSeed, modelFile, seedFile, outputFile, strength, |
@@ -143,9 +143,9 @@ public class Main { | ||
143 | 143 | Error.printError(Main.language == Main.Language.JP ? "vOªÙíI¹µÜµ½D" |
144 | 144 | : "Abnormal termination"); |
145 | 145 | } |
146 | - | |
147 | -// long end = System.currentTimeMillis(); | |
148 | -// System.err.println("time: " + (end - start) + "ms"); | |
146 | + | |
147 | + // long end = System.currentTimeMillis(); | |
148 | + // System.err.println("time: " + (end - start) + "ms"); | |
149 | 149 | } |
150 | 150 | |
151 | 151 | // R}hø |
@@ -157,30 +157,30 @@ public class Main { | ||
157 | 157 | // policyÌ\¦ |
158 | 158 | if (args.length == 1 && args[0].equals("-policy")) { |
159 | 159 | System.out |
160 | - .println("This software (CIT-BACH 1.1) is distributed under the zlib license.\n" | |
161 | - + "The software contains Java classes from JDD, a Java BDD library " | |
162 | - + "developed by Arash Vahidi.\n" | |
163 | - + "JDD is free software distributed under the zlib license.\n" | |
164 | - + "\n" | |
165 | - + "Copyright (c) 2015, Tatsuhiro Tsuchiya\n" | |
166 | - + "This software is provided 'as-is', without any express or implied \n" | |
167 | - + "warranty. In no event will the authors be held liable for any damages \n" | |
168 | - + "arising from the use of this software. \n" | |
169 | - + "\n" | |
170 | - + "Permission is granted to anyone to use this software for any purpose, \n" | |
171 | - + "including commercial applications, and to alter it and redistribute it \n" | |
172 | - + "freely, subject to the following restrictions: \n" | |
173 | - + " \n" | |
174 | - + " 1. The origin of this software must not be misrepresented; you must not \n" | |
175 | - + " claim that you wrote the original software. If you use this software \n" | |
176 | - + " in a product, an acknowledgment in the product documentation would be \n" | |
177 | - + " appreciated but is not required. \n" | |
178 | - + " \n" | |
179 | - + " 2. Altered source versions must be plainly marked as such, and must not be \n" | |
180 | - + " misrepresented as being the original software. \n" | |
181 | - + " \n" | |
182 | - + " 3. This notice may not be removed or altered from any source \n" | |
183 | - + " distribution. \n"); | |
160 | + .println("This software (CIT-BACH 1.1) is distributed under the zlib license.\n" | |
161 | + + "The software contains Java classes from JDD, a Java BDD library " | |
162 | + + "developed by Arash Vahidi.\n" | |
163 | + + "JDD is free software distributed under the zlib license.\n" | |
164 | + + "\n" | |
165 | + + "Copyright (c) 2015, Tatsuhiro Tsuchiya\n" | |
166 | + + "This software is provided 'as-is', without any express or implied \n" | |
167 | + + "warranty. In no event will the authors be held liable for any damages \n" | |
168 | + + "arising from the use of this software. \n" | |
169 | + + "\n" | |
170 | + + "Permission is granted to anyone to use this software for any purpose, \n" | |
171 | + + "including commercial applications, and to alter it and redistribute it \n" | |
172 | + + "freely, subject to the following restrictions: \n" | |
173 | + + " \n" | |
174 | + + " 1. The origin of this software must not be misrepresented; you must not \n" | |
175 | + + " claim that you wrote the original software. If you use this software \n" | |
176 | + + " in a product, an acknowledgment in the product documentation would be \n" | |
177 | + + " appreciated but is not required. \n" | |
178 | + + " \n" | |
179 | + + " 2. Altered source versions must be plainly marked as such, and must not be \n" | |
180 | + + " misrepresented as being the original software. \n" | |
181 | + + " \n" | |
182 | + + " 3. This notice may not be removed or altered from any source \n" | |
183 | + + " distribution. \n"); | |
184 | 184 | System.exit(0); |
185 | 185 | } |
186 | 186 |
@@ -271,17 +271,3 @@ public class Main { | ||
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
274 | -class InputFileData { | |
275 | - PList parameterList; | |
276 | - GList groupList; | |
277 | - List<Node> constraintList; | |
278 | - TreeSet<Integer> constrainedParameters; | |
279 | - | |
280 | - InputFileData(PList parameterList, GList groupList, | |
281 | - List<Node> constraintList, TreeSet<Integer> constrainedParameters) { | |
282 | - this.parameterList = parameterList; | |
283 | - this.groupList = groupList; | |
284 | - this.constraintList = constraintList; | |
285 | - this.constrainedParameters = constrainedParameters; | |
286 | - } | |
287 | -} |
@@ -3,8 +3,8 @@ package v1; | ||
3 | 3 | import java.util.*; |
4 | 4 | |
5 | 5 | public class Parameter { |
6 | - String name; | |
7 | - List<String> value_name = new LinkedList<String>(); | |
6 | + public String name; | |
7 | + public List<String> value_name = new LinkedList<String>(); | |
8 | 8 | |
9 | 9 | Parameter(String name) { |
10 | 10 | this.name = name; |
@@ -81,48 +81,6 @@ public class Parameter { | ||
81 | 81 | |
82 | 82 | } |
83 | 83 | |
84 | -class PList extends LinkedList<Parameter> { | |
85 | - /** | |
86 | - * | |
87 | - */ | |
88 | - private static final long serialVersionUID = 1L; | |
89 | - | |
90 | - boolean checkNameDuplication() { | |
91 | - for (int i = 0; i < this.size() - 1; i++) | |
92 | - for (int j = i + 1; j < this.size(); j++) { | |
93 | - if (this.get(i).name.equals(this.get(j).name)) { | |
94 | - return true; | |
95 | - } | |
96 | - } | |
97 | - return false; | |
98 | - } | |
99 | - | |
100 | - int getID(String str) throws NoParameterNameException { | |
101 | - for (int i = 0; i < this.size(); i++) { | |
102 | - if (this.get(i).name.equals(str)) | |
103 | - return i; | |
104 | - } | |
105 | - throw new NoParameterNameException(); | |
106 | - } | |
107 | - | |
108 | - // useless? | |
109 | - int getRestrictedID(String str, TreeSet<Integer> RestrictedParameters) | |
110 | - throws NoParameterNameException { | |
111 | - try { | |
112 | - int parameter = this.getID(str); | |
113 | - int num = 0; | |
114 | - for (Integer i: RestrictedParameters) { | |
115 | - if (i == parameter) | |
116 | - return num; | |
117 | - num++; | |
118 | - } | |
119 | - } catch (NoParameterNameException e) { | |
120 | - throw e; | |
121 | - } | |
122 | - // if the parameter is not a relevant one | |
123 | - throw new NoParameterNameException(); | |
124 | - } | |
125 | -} | |
126 | 84 | |
127 | 85 | class NoParameterNameException extends Exception { |
128 | 86 |
@@ -2,11 +2,11 @@ package v1; | ||
2 | 2 | |
3 | 3 | public class ParameterModel { |
4 | 4 | // öqÌ |
5 | - final int size; | |
5 | + public final int size; | |
6 | 6 | // eöqÌx |
7 | - final byte[] range; | |
7 | + public final byte[] range; | |
8 | 8 | |
9 | - ParameterModel(PList plist) { | |
9 | + public ParameterModel(PList plist) { | |
10 | 10 | size = plist.size(); |
11 | 11 | this.range = new byte[size]; |
12 | 12 | for (int i = 0; i < size; i++) { |
@@ -25,92 +25,6 @@ public class TestcaseHandler { | ||
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | -class Testcase { | |
29 | - byte[] value; // 0..level-1, or <0 (wildcard) | |
30 | - | |
31 | - // ±êð¼©çÇñÅéÆܸ¢©àH | |
32 | - Testcase(int n) { | |
33 | - this.value = new byte[n]; | |
34 | - } | |
35 | - | |
36 | - void set(int parameter, byte value) { | |
37 | - this.value[parameter] = value; | |
38 | - } | |
39 | - | |
40 | - void setWildCard(int parameter) { | |
41 | - this.value[parameter] = -1; | |
42 | - } | |
43 | - | |
44 | - byte get(int parameter) { | |
45 | - return value[parameter]; | |
46 | - } | |
47 | - | |
48 | - int getint(int parameter) { | |
49 | - return (int) value[parameter]; | |
50 | - } | |
51 | - | |
52 | - void quantify() { | |
53 | - for (int i = 0; i < this.value.length; i++) | |
54 | - this.value[i] = -1; | |
55 | - } | |
56 | - | |
57 | - Testcase makeClone() { | |
58 | - Testcase newtest = new Testcase(this.value.length); | |
59 | - for (int i = 0; i < newtest.value.length; i++) { | |
60 | - newtest.value[i] = this.value[i]; | |
61 | - } | |
62 | - return newtest; | |
63 | - } | |
64 | - | |
65 | - void print() { | |
66 | - for (int i = 0; i < value.length; i++) | |
67 | - System.err.print(value[i] + ","); | |
68 | - System.err.println(); | |
69 | - } | |
70 | - | |
71 | - // TODO Outputer.java ÉÚ® | |
72 | - void print(BufferedWriter writer, InputFileData inputfiledata) | |
73 | - throws IOException { | |
74 | - for (int i = 0; i < value.length; i++) | |
75 | - writer.write((i == 0 ? "" : ",") | |
76 | - + inputfiledata.parameterList.get(i).value_name | |
77 | - .get(value[i])); | |
78 | - writer.write("\n"); | |
79 | - } | |
80 | - | |
81 | - // tupleðdËé | |
82 | - // return true if a tuple is superimposed | |
83 | - // d˽ÉÖ¥Éá½·é±Æ è->`FbN·é | |
84 | - boolean superimpose(Testcase tuple, ConstraintHandler h) { | |
85 | - Testcase tmp = this.makeClone(); | |
86 | - if (tmp.superimpose(tuple) == false) | |
87 | - return false; | |
88 | - if (h.isPossible(tmp) == false) | |
89 | - return false; | |
90 | - return this.superimpose(tuple); | |
91 | - // must be true; | |
92 | - } | |
93 | - | |
94 | - // tupleðdËé | |
95 | - // return true if a tuple is superimposed | |
96 | - // d˽ÉÖ¥Éá½·é±Æ è->`FbNµÈ¢ | |
97 | - private boolean superimpose(Testcase tuple) { | |
98 | - // TODO Auto-generated method stu | |
99 | - for (int i = 0; i < value.length; i++) { | |
100 | - if (value[i] < 0 || tuple.value[i] < 0) | |
101 | - continue; | |
102 | - if (value[i] == tuple.value[i]) | |
103 | - continue; | |
104 | - return false; | |
105 | - } | |
106 | - | |
107 | - for (int i = 0; i < value.length; i++) { | |
108 | - if (value[i] < 0) | |
109 | - this.set(i, tuple.get(i)); | |
110 | - } | |
111 | - return true; | |
112 | - } | |
113 | -} | |
114 | 28 | |
115 | 29 | class Testsuite { |
116 | 30 | List<Testcase> test; |