SWE 437 In Class Exercise # 20
Transition to Logic Testing


Names:
Instructions: Work with your neighbors in groups. This is another graph coverage for source code. Consider the following code:
// GoodFastCheap: Investigating graph testing with an old engineering joke

public final class GoodFastCheap {

    boolean good  = false;
    boolean fast  = false;
    boolean cheap = false;

    public void makeGood () {
       good = true;
       if (fast && cheap) { cheap = false; }
    }

    public void makeFast () {
       fast = true; 
       if (good && cheap) { good = false; }
    }

    public void makeCheap () {
       cheap = true;
       if (fast && good) { fast = false; }
    }

    public void makeBad ()       { good = false; }
    public void makeSlow ()      { fast = false; }
    public void makeExpensive () { cheap = false; }

    public boolean isSatisfactory() {
       if ((good && fast) || (good && cheap) || (fast && cheap)) {
          return true;
       }
       return false;
    }
}
Try to identify a state space suitable for a graph model from the instance variables in this program.

Identify the transitions in this state space. To make this easier, start by ignoring the methods that make things worse.

Choose a coverage criterion and develop tests that satisfy the criterion.

Logic coverage: When does each clause determine the value of a predicate?