(Software Testing)
Homework #, BRO
Generate a BRO‐adequate test set TBRO for
pr: (a<0) ∨ (b=1) ∧ (c>2) ∨ (D ∧ !E)
where a, b, c are integer variables and D, E are Boolean
variables.
Show all the steps in generating TBRO.
Draw the abstract syntax tree (AST) and label the nodes N1 to
Nm.
Explicitly list the true and false constraint sets for each node in
the AST.
Remember to generate a test set TBRO corresponding to the root node
in
the AST.
ackage com.one;
public class X00000000 extends Polynomial {
public static void main(String args[]) throws Exception {
Polynomial p = new X00000000(" X^5"), q = new X00000000("X^2 - X + 1");
Utility.run(p, q);
}
public X00000000(String s) {
// parse string character by character
double coef = 0; // coefficient of term
int deg = 0; // degree of term
String[] terms = s.split(" ");
for (int i = 0; i < terms.length; i++) {
String term = terms[i];
// System.out.println("term:"+term);
String prevTerm = "";
if (i != 0)
prevTerm = terms[i - 1];
if (term.startsWith("X")) {
if (term.length() == 3 && term.contains("^")) {
coef = 1;
deg = Integer.parseInt(term.substring(2));
} else if (term.length() == 1) {
deg = 1;
if (prevTerm.equals("-"))
coef = -1;
else
coef = 1;
}
} else if (term.startsWith("-") || term.startsWith("+"))
continue;
else if (term.length() == 1 && Character.isDigit(term.charAt(0))) {
coef = Integer.parseInt(term);
if (prevTerm.equals("-"))
coef *= -1;
deg = 0;
}
Term T = new Term(coef, deg);
if (data.isEmpty()) {
data.addFirst(T);
} else {
data.addLast(T);
}
}
}
public X00000000() {
super();
}
public Polynomial add(Polynomial p) {
Polynomial ans = new X00000000();
// complete this code
return ans;
}
public Polynomial subtract(Polynomial p) {
Polynomial ans = new X00000000();
// complete this code
return ans;
}
public Polynomial multiply(Polynomial p) {
Polynomial ans = new X00000000();
// complete this code
return ans;
}
public Polynomial divide(Polynomial p) throws Exception {
Polynomial ans = new X00000000();
// complete this code
return ans;
}
public Polynomial remainder(Polynomial p) throws Exception {
Polynomial ans = new X00000000();
// complete this code
return ans;
}
}
(Software Testing) Homework #, BRO Generate a BRO‐adequate test set TBRO for pr: (a<0) ∨ (b=1)...