Question: Design, implement, and run PC ( Predicate Coverage ) , CC ( Clause Coverage ) and CACC ( Correlated Active Clause Coverage ) tests for

Design, implement, and run PC (Predicate Coverage), CC (Clause Coverage) and CACC (Correlated Active Clause Coverage) tests for the method turnHeaterOn in class Thermostat.java
1.(5 points) List all predicates in the method. How many have one clause, two clauses, three clauses, and more than three?
2. For each predicate, write the truth table and choose rows from the truth tables that satisfy PC.
a.(10 points) You must submit the truth tables and clearly mark which rows will be used. These are your abstract tests.
b.(5 points) For each abstract test, create input values that satisfy the truth assignments and that reach the predicate.
c.(10 points) Implement each test in Junit file "ThermostatTest_PC.java". Include comments that state which predicate and which truth assignment (row in the truth table) is being implemented.
d.(5 points) Run your tests.
3. For each predicate, write the truth table and choose rows from the truth tables that satisfy CC.
a.(10 points) You must submit the truth tables and clearly mark which rows will be used. These are your abstract tests.
b.(5 points) For each abstract test, create input values that satisfy the truth assignments and that reach the predicate.
c.(10 points) Implement each test in Junit file "ThermostatTest_CC.java". Include comments that state which predicate and which truth assignment (row in the truth table) is being implemented.
d.(5 points) Run your tests.
4. For each predicate, write the truth table and choose rows from the truth tables that satisfy CACC.
a.(10 points) You must submit the truth tables and clearly mark which rows will be used. These are your abstract tests.
b.(5 points) For each abstract test, create input values that satisfy the truth assignments and that reach the predicate.
c.(10 points) Implement each test in Junit file "ThermostatTest_CACC.java". Include comments that state which predicate and which truth assignment (row in the truth table) is being implemented.
d.(5 points) Run your tests. ```
package thermostat;
//Introduction to Software Testing
//Authors: Paul Ammann & Jeff Offutt
//Chapter 8, page ??
//See ThermostatTest.java for JUnit tests
import java.io.*;
import java.util.*;
//Programmable Thermostat
public class Thermostat{
private int curTemp; // current temperature reading
private int thresholdDiff; // temp difference until we turn heater on
private int timeSinceLastRun; // time since heater stopped
private int minLag; // how long I need to wait
private boolean override; // has user overridden the program
private int overTemp; // overriding temperature
private int runTime; // output of turnHeaterOn - how long to run
private boolean heaterOn; // output of turnHeaterOn - whether to run
private Period period; // morning, day, evening, or night
private DayType day; // week day or weekend day
// Decide whether to turn the heater on, and for how long.
public boolean turnHeaterOn (ProgrammedSettings pSet)
{
int dTemp = pSet.getSetting (period, day);
if (((curTemp dTemp - thresholdDiff)||
(override && curTemp overTemp - thresholdDiff)) &&
(timeSinceLastRun > minLag))
{// Turn on the heater
// How long? Assume 1 minute per degree (Fahrenheit)
int timeNeeded = curTemp - dTemp;
if (override)
timeNeeded = curTemp - overTemp;
setRunTime (timeNeeded);
setHeaterOn (true);
}
return (true);
else
{
}
setHeaterOn (false);
return (false);
}// End turnHeaterOn
public void setCurrentTemp (int temperature){ curTemp = temperature; }
public void setThresholdDiff (int delta){ thresholdDiff = delta; }
public void setTimeSinceLastRun (int minutes){ timeSinceLastRun = minutes; }
public void setMinLag (int minutes){ minLag = minutes; }
public void setOverride (boolean value){ override = value; }
public void setOverTemp (int temperature){ overTemp = temperature; }
// for the ProgrammedSettings
public void setDay (DayType curDay){ day = curDay; }
public void setPeriod (Period curPeriod){ period = curPeriod; }
// outputs from turnHeaterOn - need corresponding getters to activate heater
void setRunTime (int minutes){ runTime = minutes; }
void setHeaterOn (boolean value){ heaterOn = value; }
}// End Thermostat class
``````
package thermostat;
//Used with the Thermostat.java example, Chapter 8
import java.util.*;
public class ProgrammedSettings
{
private Map> settings =
new HashMap>();
// Property
public ProgrammedSettings ()
{
for (Period p : Period.values())
{
HashMap m = new HashMap();
settings.put (p, m);
for (DayType d : DayType.values())
{
m.put (d,65); // Default value, 18.33C
}
}
}
public void setSetting (Period period, DayType day, int temp)
{
}
settings.get (period).put (day, temp);
public int getSetting (Period period, DayType day)
{
}
return settings.get (period).get (day);
public String toString()
{
}```
package thermostat;
public enum Period {
MORNING, DAY, EVENING, NIGHT
}
``````
package thermostat;
public enum DayType {
WEEKDAY, WEEKEND
}
```
Design, implement, and run PC ( Predicate

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!