• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine 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

Revision446e4f13d917ec3a3eadf7398ac8076db1f1050a (tree)
Zeit2015-05-22 18:55:32
Autort-tutiya <tatsuhiro@ieee...>
Commitert-tutiya

Log Message

Bug fixes related to ref/deref of BDD nodes

Ändern Zusammenfassung

Diff

--- a/src/v1/ConstraintHandler.java
+++ b/src/v1/ConstraintHandler.java
@@ -7,14 +7,16 @@ import java.util.ArrayList;
77 import java.util.List;
88
99 class ConstraintHandler {
10+ static final int sizeOfNodetable = 1000;
11+ static final int sizeOfCache = 1000;
12+
1013 List<VariableAndBDD> parameters = null;
1114 BDD bdd;
1215 int bddConstraint;
1316 int numOfBDDvariables;
1417
1518 ConstraintHandler(PList parameterList, List<Node> constraintList) {
16- //TODO BDDを設定 -> 1000, ... 文字定数化
17- bdd = new BDD(1000,1000);
19+ bdd = new BDD(sizeOfNodetable, sizeOfCache);
1820 bdd = new jdd.bdd.debug.DebugBDD(1000,1000);
1921
2022 //parameterのリスト
@@ -70,28 +72,26 @@ class ConstraintHandler {
7072 bdd.ref(g);
7173 for (int j = var.length - 1; j > i; j--) {
7274 if ((p.value_name.size() - 1 & (0x01 << j)) > 0) {
73- g = bdd.ref(bdd.and(g, var[j]));
75+ int tmp = bdd.ref(bdd.and(g, var[j])); bdd.deref(g); g = tmp;
7476 } else {
75- g = bdd.ref(bdd.and(g, bdd.not(var[j])));
77+ int tmp = bdd.ref(bdd.and(g, bdd.not(var[j]))); bdd.deref(g); g = tmp;
7678 }
7779 }
78- g = bdd.ref(bdd.and(g, bdd.not(var[i])));
79- f = bdd.ref(bdd.or(f, g));
80+ int tmp = bdd.ref(bdd.and(g, bdd.not(var[i]))); bdd.deref(g); g = tmp;
81+ tmp = bdd.ref(bdd.or(f, g)); bdd.deref(g); f = tmp;
8082 }
8183 }
82- bdd.ref(f); // useless?
8384
8485 // domain - 1自身
8586 int g = bdd.getOne();
8687 bdd.ref(g);
8788 for (int i = var.length - 1; i >= 0; i--) {
8889 if ((p.value_name.size() - 1 & (0x01 << i)) > 0) {
89- g = bdd.ref(bdd.and(g, var[i]));
90+ int tmp = bdd.ref(bdd.and(g, var[i])); bdd.deref(g); g = tmp;
9091 } else {
91- g = bdd.ref(bdd.and(g, bdd.not(var[i])));
92+ int tmp = bdd.ref(bdd.and(g, bdd.not(var[i]))); bdd.deref(g); g = tmp;
9293 }
9394 }
94- bdd.ref(g);
9595
9696 int d = bdd.or(f, g);
9797 bdd.ref(d);
@@ -105,25 +105,19 @@ class ConstraintHandler {
105105 }
106106
107107 private int setBddConstraint(List<Node> constraintList) {
108- // TODO Auto-generated method stub
109108 int f = bdd.getOne();
110109 bdd.ref(f);
111110
112111 // パラメータでつかわない領域をfalseにする
113112 for (VariableAndBDD vb : parameters) {
114- f = bdd.and(f, vb.constraint);
115- bdd.ref(f);
113+ int tmp = bdd.ref(bdd.and(f, vb.constraint)); bdd.deref(f); f = tmp;
116114 }
117115
118116 // 制約式の論理積をとる
119117 for (Node n: constraintList) {
120118 int g = n.evaluate(bdd, parameters);
121- bdd.ref(g);
122- f = bdd.and(f, g);
123- bdd.ref(f);
124- bdd.deref(g);
119+ int tmp = bdd.ref(bdd.and(f, g)); bdd.deref(f); bdd.deref(g); f = tmp;
125120 }
126-// bdd.ref(f);
127121
128122 // *を付加
129123 f = extendBddConstraint(f);
@@ -135,17 +129,13 @@ class ConstraintHandler {
135129 int f = constraint;
136130 for (VariableAndBDD p : parameters) {
137131 int cube = p.var[0];
132+ bdd.ref(cube);
138133 for (int i = 1; i < p.var.length; i++) {
139- cube = bdd.ref(bdd.and(cube, p.var[i]));
134+ int tmp = bdd.ref(bdd.and(cube, p.var[i])); bdd.deref(cube); cube = tmp;
140135 }
141- bdd.ref(cube);
142136 int tmp0 = bdd.ref(bdd.exists(f, cube));
143- bdd.ref(tmp0);
144137 int tmp = bdd.ref(bdd.and(tmp0, cube));
145- bdd.ref(tmp);
146- int newf =
147- bdd.ref(bdd.or(f, tmp));
148- bdd.ref(newf);
138+ int newf = bdd.ref(bdd.or(f, tmp));
149139
150140 bdd.deref(cube);
151141 bdd.deref(tmp0);
@@ -156,7 +146,7 @@ class ConstraintHandler {
156146 return f;
157147 }
158148
159- //TODO テストケースが制約を満たすか
149+ // テストケースが制約を満たすか
160150 boolean isPossible (Testcase test) {
161151 int node = bddConstraint;
162152 boolean[] bv = binarize(test);
--- a/src/v1/Node.java
+++ b/src/v1/Node.java
@@ -175,18 +175,16 @@ class EqualityOfParameterAndValue extends ComparisonOfParameterAndValue {
175175 int evaluate(BDD bdd, List<VariableAndBDD> parameters) {
176176 int res = bdd.getOne();
177177 bdd.ref(res);
178- // deref 必要?
179178 int[] var = parameters.get(this.p).var;
180179 for (int i = var.length - 1; i >= 0; i--) {
181- if ((this.v & (0x01 << i)) > 0)
182- res = bdd.ref(bdd.and(res, var[i]));
183- else
184- res = bdd.ref(bdd.and(res, bdd.not(var[i])));
180+ if ((this.v & (0x01 << i)) > 0) {
181+ int tmp = bdd.ref(bdd.and(res, var[i])); bdd.deref(res); res = tmp;
182+ }
183+ else {
184+ int tmp = bdd.ref(bdd.and(res, bdd.not(var[i]))); bdd.deref(res); res = tmp;
185+ }
185186 }
186187 bdd.ref(res);
187188 return res;
188189 }
189-}
190-
191-
192-
190+}
\ No newline at end of file