• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
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

Revision952a25fd0cbfbab8452446f6562867fe2e1e87cc (tree)
Time2015-10-16 14:12:00
Authort-tutiya <tatsuhiro@ieee...>
Commitert-tutiya

Log Message

Support arithmetic comparator !===
Add a TreeSet to represent constrained parameters

Change Summary

Incremental Difference

--- a/src/v1/Inputer.java
+++ b/src/v1/Inputer.java
@@ -224,8 +224,10 @@ public class Inputer {
224224 if (t.peepToken() == null) {
225225 break;
226226 }
227- Node n = new Parse(t, parameterList).parseExpression();
228- constraintList.add(n);
227+ //Node n = new Parse(t, parameterList).parseExpression();
228+ NodeAndConstrainedParameters res = new Parse(t, parameterList).extendedParseExpression();
229+ constraintList.add(res.node);
230+ System.err.println(res.constrainedParameters.toString());
229231 }
230232 return constraintList;
231233 }
--- a/src/v1/Parse.java
+++ b/src/v1/Parse.java
@@ -1,17 +1,34 @@
11 package v1;
22
3-import java.util.ArrayList;
43 import java.util.List;
4+import java.util.TreeSet;
5+
6+class NodeAndConstrainedParameters {
7+ Node node;
8+ TreeSet<Integer> constrainedParameters;
9+}
510
611 public class Parse {
712 private TokenHandler t;
813 private PList parameterList;
914
15+ private TreeSet<Integer> constrainedParameters = new TreeSet<Integer>();
16+
1017 Parse(TokenHandler t, PList parameterList) {
1118 this.t = t;
1219 this.parameterList = parameterList;
20+
21+ // extension to ..
22+ this.constrainedParameters = new TreeSet<Integer>();
1323 }
1424
25+ public NodeAndConstrainedParameters extendedParseExpression() {
26+ NodeAndConstrainedParameters res = new NodeAndConstrainedParameters();
27+ res.node = parseExpression();
28+ res.constrainedParameters = this.constrainedParameters;
29+ return res;
30+ }
31+
1532 public Node parseExpression() {
1633 String nextToken = t.peepToken();
1734 try {
@@ -19,8 +36,11 @@ public class Parse {
1936 Error.printError(Main.language == Main.Language.JP ? "制約式に誤りがあります"
2037 : "Invalid constraints");
2138 return null;
22- } else if (nextToken.equals("("))
39+ }
40+ else if (nextToken.equals("(")) {
41+ // debug: System.err.println(this.constrainedParameters.toString());
2342 return expressionWithParentheses();
43+ }
2444 else {
2545 // error
2646 Error.printError(Main.language == Main.Language.JP ? "制約に'('がありません"
@@ -178,28 +198,38 @@ public class Parse {
178198 else if (token.equals("<>"))
179199 return inequalityAtomExpression();
180200 else if (token.equals("==="))
181- return artithmeticEqualityAtomExpression(new EqualTo(), new EqualTo());
201+ return arithmeticEqualityAtomExpression(new EqualTo(), new EqualTo());
202+ else if (token.equals("!=="))
203+ return artithmeticInequalityAtomExpression(new EqualTo(), new EqualTo());
182204 else if (token.equals("<"))
183- return artithmeticEqualityAtomExpression(new LessThan(), new GreaterThan());
205+ return arithmeticEqualityAtomExpression(new LessThan(), new GreaterThan());
184206 else if (token.equals(">"))
185- return artithmeticEqualityAtomExpression(new GreaterThan(), new LessThan());
207+ return arithmeticEqualityAtomExpression(new GreaterThan(), new LessThan());
186208 else if (token.equals("<="))
187- return artithmeticEqualityAtomExpression(new LTE(), new GTE());
209+ return arithmeticEqualityAtomExpression(new LTE(), new GTE());
188210 else if (token.equals(">="))
189- return artithmeticEqualityAtomExpression(new GTE(), new LTE());
211+ return arithmeticEqualityAtomExpression(new GTE(), new LTE());
190212 else
191213 Error.printError(Main.language == Main.Language.JP ? "制約式に == か <> が必要です"
192214 : "== or <> expected in constraints");
193215 return null;
194216 }
195217
218+ private Node artithmeticInequalityAtomExpression(RelationOverDoublePair com1,
219+ RelationOverDoublePair com2) throws OutOfTokenStreamException {
220+ // TODO Auto-generated method stub
221+ BooleanUnaryOperator res = new NotOperator();
222+ res.Child = arithmeticEqualityAtomExpression(com1, com2);
223+ return res;
224+ }
225+
196226 private Node inequalityAtomExpression() throws OutOfTokenStreamException {
197227 BooleanUnaryOperator res = new NotOperator();
198228 res.Child = equalityAtomExpression();
199229 return res;
200230 }
201231
202- private Node artithmeticEqualityAtomExpression(RelationOverDoublePair com1, RelationOverDoublePair com2)
232+ private Node arithmeticEqualityAtomExpression(RelationOverDoublePair com1, RelationOverDoublePair com2)
203233 throws OutOfTokenStreamException {
204234 // case 1 val1 val2 com1
205235 // case 2 val1 [para1] com2
@@ -353,6 +383,7 @@ public class Parse {
353383 // 因子名が正しいかチェック
354384 try {
355385 parameterID = parameterList.getID(para);
386+ this.constrainedParameters.add(parameterID);
356387 } catch (NoParameterNameException e) {
357388 Error.printError(Main.language == Main.Language.JP ? "制約中の因子名に誤りがあります"
358389 : "Invalid parameter name in constraints");
@@ -396,6 +427,7 @@ public class Parse {
396427 // 因子名が正しいかチェック
397428 try {
398429 parameterID = parameterList.getID(para);
430+ this.constrainedParameters.add(parameterID);
399431 } catch (NoParameterNameException e) {
400432 Error.printError(Main.language == Main.Language.JP ? "制約中の因子名に誤りがあります"
401433 : "Invalid parameter name in constraints");
@@ -447,6 +479,8 @@ public class Parse {
447479 try {
448480 parameterID1 = parameterList.getID(para1);
449481 parameterID2 = parameterList.getID(para2);
482+ this.constrainedParameters.add(parameterID1);
483+ this.constrainedParameters.add(parameterID2);
450484 } catch (NoParameterNameException e) {
451485 Error.printError(Main.language == Main.Language.JP ? "制約中の因子名に誤りがあります"
452486 : "Invalid parameter name in constraints");
@@ -523,6 +557,8 @@ public class Parse {
523557 try {
524558 parameterID1 = parameterList.getID(para1);
525559 parameterID2 = parameterList.getID(para2);
560+ this.constrainedParameters.add(parameterID1);
561+ this.constrainedParameters.add(parameterID2);
526562 } catch (NoParameterNameException e) {
527563 Error.printError(Main.language == Main.Language.JP ? "制約中の因子名に誤りがあります"
528564 : "Invalid parameter name in constraints");