! ! Bob Morrison HCS_C Xpress Control Program ! Regression Test Program 0.03 ! revised 7/5/2005 ! NOTE: This test requires that LCD_Link be connected begin ! Start with display dumps to the Console, local LCD, and the ! RS485 LCD_Link. Kick off some timers to initiate testing. if reset then variable(3) = (64) console = "Starting HCS_C Regression Test 0.03" hcs_net(0) = "s=HCS_C Test 0.03" hcs_net(0) = "q" hcs_net(0) = "s=I'm OK" hcs_string = "HCS_C Test 0.03" hcs_string = "I'm OK" timer(250) = on timer(10) = on end !! Test simple IF-END if timer(250) = 2 then console = "Timer triggered stage 1" timer(250) = off timer(1) = on module(B16) = off output(20) = 1 output(21) = 1 end !! Test continuous IF-END !! Test bit operation of IO lines if 1 then output(1) = input(1) end !! Test IF-ELSE-END !vars[99] is at locvars+198 if change_value(timer(1)) = 3 then variable(100) = timer(1) + 56 else variable(99) = timer(1) end !! Test CHANGED, logical and if changed(variable(99)) and (timer(1) = 5) then console = "Timer 1 triggered stage 2" timer(1) = off timer(68) = on end !! Test nested IF-END !! test variable reference and RS485 query if changed(timer(68)) then if (timer(68) = 5) then if (hcs_net(3) = 0x54) and (hcs_net(4) = 0x45) and (hcs_net(5) = 0x52) and (hcs_net(6) = 0x4d) and (hcs_net(7) = 0x30) then variable(20) = hcs_net(9) variable(21) = hcs_net(10) console = "hcs_net rs485 read %x2 %x2",variable(20),variable(21) console = "Timer 68 triggered stage 3" timer(68) = off timer(69) = on end end end !! Test nested IF-ELSE-END !computation test. if 7 = (((timer(69) / 2) * 4 - 3) & ~0xfff0 | 2) then console = "uhhh..?" if 4 - 4 + 4 - (4) + -4 - (-4) = 0 then console = "beep" hcs_net(0) = "q" hcs_net(0) = "s=RS485 is OK TX and RX" variable(10) = 1 timer(72) = on timer(69) = off else variable(10) = 0 end else variable(8) = 3 end !! Test nested IF-IS-ELSE-END if 1 = variable(10) then if changed(timer(72)) then if timer(72) is 1 then console = "Test countdown 4" timer(55) = on is 2 then console = "Test countdown 3" is 3 then console = "Test countdown 2" variable(6) = 1000 is 4 then console = "Test countdown 1" is 0 then else console = "Test stage I passed" hcs_net(0) = "s=Test STAGE I OK" hcs_string = "Test STAGE I OK" variable(10) = 23 end end end !! Test big messy nested IF-IS/IF-END if change_value(timer(55)) is 1 then log mode actions is 2 then variable(4) = 0 is 3 then if variable(10) = 0 then console = "Test FAILED" else variable(211) = 0x1234 variable(6) = 0 console = "Test CONTINUING STAGE II" end is 5 then if variable(211) = 0x1234 then if variable(4) <> 12 then variable(211) = 0 timer(101) = on end end is 6 then timer(55) = pause console = "Stopped timer 55" is 7 then if (timer(101)) = 5 then console = "Test timer7 hit" timer(7) = on end is 14 then if timer(7) = 0 then console = "Test stage II passed" hcs_net(0) = "s=Test STAGE II OK" hcs_string = "Test STAGE II OK" log mode off end else if timer(7) = 3 then variable(6) = variable(6) + 1 if variable(6) is 3 then timer(7) = clear console = "Restarted timer 55" is 5 then timer(7) = off end end end !Test timer control if timer(55) = 6 and (change_value(timer(101)) = 3) then timer(55) = continue console = "Restarted timer 55" end