• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Testcase generation tool for combinatorial interaction testing


Commit MetaInfo

修订版8a74ddaed8b64ede9d3608c955e0f96862c58588 (tree)
时间2018-07-27 13:35:25
作者Tatsuhiro Tsuchiya <t-tutiya@ist....>
CommiterTatsuhiro Tsuchiya

Log Message

Create new program to find forbidden pairs

更改概述

差异

--- a/.classpath
+++ b/.classpath
@@ -1,7 +1,11 @@
11 <?xml version="1.0" encoding="UTF-8"?>
22 <classpath>
33 <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>
59 <classpathentry kind="lib" path="lib/jdd_104.jar"/>
610 <classpathentry kind="output" path="bin"/>
711 </classpath>
--- a/.project
+++ b/.project
@@ -1,6 +1,6 @@
11 <?xml version="1.0" encoding="UTF-8"?>
22 <projectDescription>
3- <name>IPOG_bach</name>
3+ <name>cit_bach</name>
44 <comment></comment>
55 <projects>
66 </projects>
--- a/inputsamples/test1.txt
+++ b/inputsamples/test1.txt
@@ -10,11 +10,11 @@ Disk2 (SDD HDD)
1010 {OS メモリ Disk} {メモリ Disk CPU}
1111
1212 # 制約(禁則)を列挙
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]) ))
1414
15-(ite (== [Disk] [Disk2]) (== [メモリ] 4GB) (<> [メモリ] 2GB))
15+# (ite (== [Disk] [Disk2]) (== [メモリ] 4GB) (<> [メモリ] 2GB))
1616
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] )))
1818
1919 # 単項演算子:not
2020 # 2項演算子:==,<>, if
--- a/src/v1/ConstraintHandler.java
+++ b/src/v1/ConstraintHandler.java
@@ -7,7 +7,7 @@ import java.util.Collections;
77 import java.util.List;
88 import java.util.TreeSet;
99
10-class ConstraintHandler {
10+public class ConstraintHandler {
1111 static final int sizeOfNodetable = 10000;
1212 static final int sizeOfCache = 10000;
1313
@@ -34,7 +34,7 @@ class ConstraintHandler {
3434
3535
3636 // 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) {
3838 bdd = new BDD(sizeOfNodetable, sizeOfCache);
3939 // bdd = new jdd.bdd.debug.DebugBDD(1000,1000);
4040
@@ -227,7 +227,7 @@ class ConstraintHandler {
227227 }
228228 }
229229
230- boolean isPossible(Testcase test) {
230+ public boolean isPossible(Testcase test) {
231231 int node = bddConstraint;
232232 boolean[] bv = binarizeReduced(test);
233233
--- a/src/v1/Error.java
+++ b/src/v1/Error.java
@@ -10,11 +10,11 @@ public class Error {
1010 // default でエラーは標準出力
1111 static String filename = null;
1212
13- static void setOutputFile(String filename) {
13+ public static void setOutputFile(String filename) {
1414 Error.filename = filename;
1515 }
1616
17- static void printError(String str) {
17+ public static void printError(String str) {
1818 BufferedWriter writer;
1919 try {
2020 if (filename == null) {
--- a/src/v1/Inputer.java
+++ b/src/v1/Inputer.java
@@ -182,7 +182,7 @@ public class Inputer {
182182 return tokenList;
183183 }
184184
185- static InputFileData readModel(String filename) {
185+ public static InputFileData readModel(String filename) {
186186
187187 BufferedReader reader = openFile(filename);
188188 List<String> tokenList = makeTokenList(reader);
--- a/src/v1/Main.java
+++ b/src/v1/Main.java
@@ -30,7 +30,7 @@ public class Main {
3030 public static void main(String[] args) {
3131
3232 long start = System.currentTimeMillis();
33-
33+
3434 try {
3535 // コマンド引数処理
3636 String errorMessage = processCommandArgument(args);
@@ -48,7 +48,7 @@ public class Main {
4848
4949 // 制約処理 BDD作成
5050 // System.err.println("starting building bdd");
51-
51+
5252 // old version where all parameters are considered in BDD
5353 // ConstraintHandler conhndl = new ConstraintHandler(
5454 // inputfiledata.parameterList, inputfiledata.constraintList);
@@ -74,7 +74,7 @@ public class Main {
7474 Error.printError(Main.language == Main.Language.JP ? "テストケース数が上限"
7575 + Generator.MaxNumOfTestcases + "を超えました"
7676 : "The number of test cases exceeded the upper bound "
77- + Generator.MaxNumOfTestcases);
77+ + Generator.MaxNumOfTestcases);
7878 }
7979
8080 new Outputer(outputFile).outputResult(testSet, inputfiledata,
@@ -125,7 +125,7 @@ public class Main {
125125 Error.printError(Main.language == Main.Language.JP ? "テストケース数が上限"
126126 + Generator.MaxNumOfTestcases + "を超えました"
127127 : "The number of test cases exceeded the upper bound "
128- + Generator.MaxNumOfTestcases);
128+ + Generator.MaxNumOfTestcases);
129129
130130 new Outputer(outputFile).outputResult(testSet, inputfiledata,
131131 randomSeed, modelFile, seedFile, outputFile, strength,
@@ -143,9 +143,9 @@ public class Main {
143143 Error.printError(Main.language == Main.Language.JP ? "プログラムが異常終了しました."
144144 : "Abnormal termination");
145145 }
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");
149149 }
150150
151151 // コマンド引数処理
@@ -157,30 +157,30 @@ public class Main {
157157 // policyの表示
158158 if (args.length == 1 && args[0].equals("-policy")) {
159159 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");
184184 System.exit(0);
185185 }
186186
@@ -271,17 +271,3 @@ public class Main {
271271 }
272272 }
273273
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-}
--- a/src/v1/Parameter.java
+++ b/src/v1/Parameter.java
@@ -3,8 +3,8 @@ package v1;
33 import java.util.*;
44
55 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>();
88
99 Parameter(String name) {
1010 this.name = name;
@@ -81,48 +81,6 @@ public class Parameter {
8181
8282 }
8383
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-}
12684
12785 class NoParameterNameException extends Exception {
12886
--- a/src/v1/ParameterModel.java
+++ b/src/v1/ParameterModel.java
@@ -2,11 +2,11 @@ package v1;
22
33 public class ParameterModel {
44 // 因子の数
5- final int size;
5+ public final int size;
66 // 各因子のレベル数
7- final byte[] range;
7+ public final byte[] range;
88
9- ParameterModel(PList plist) {
9+ public ParameterModel(PList plist) {
1010 size = plist.size();
1111 this.range = new byte[size];
1212 for (int i = 0; i < size; i++) {
--- a/src/v1/TestcaseHandler.java
+++ b/src/v1/TestcaseHandler.java
@@ -25,92 +25,6 @@ public class TestcaseHandler {
2525 }
2626 }
2727
28-class Testcase {
29- byte[] value; // 0..level-1, or <0 (wildcard)
30-
31- // これを他から読んでるとまずいかも?
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を重ねる
82- // return true if a tuple is superimposed
83- // 重ねた時に禁則に違反することあり->チェックする
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を重ねる
95- // return true if a tuple is superimposed
96- // 重ねた時に禁則に違反することあり->チェックしない
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-}
11428
11529 class Testsuite {
11630 List<Testcase> test;