Adding path explorations for initializations.
[smartthings-infrastructure.git] / Switch / Switches.groovy
index 9007388794254b1decf95d3eca6d96aae4978df7..36ba2de02918205039019e374806ad975c3f98ee 100644 (file)
@@ -2,6 +2,9 @@
 package Switch
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class Switches {
        int deviceNumbers       
        List switches
@@ -22,6 +25,19 @@ public class Switches {
                this.timers = new SimulatedTimer()
                this.deviceNumbers = deviceNumbers
                this.switches = []
+               
+               def initLevel = Verify.getIntFromList(30, 50, 70)
+               this.currentLevel = initLevel
+               def init = Verify.getBoolean()
+               if (init) {
+                       this.switchState = "off"
+                       this.currentSwitch = "off"
+                       this.switchLatestValue = "off"
+               } else {
+                       this.switchState = "on"
+                       this.currentSwitch = "on"
+                       this.switchLatestValue = "on"
+               }
 
                switches.add(new Switch(sendEvent, id, label, displayName, this.switchState, this.currentSwitch, this.currentLevel, this.switchLatestValue))
        }