; Unit test for TestLight
; Justin Ray
; Last modified 2009-05-07

;Note: Assertions must be inserted more than two periods after a message or physical
;value has been inserted to be sure that the change propagates through the system

;can ID's used:
;DoorClosed Front Left = 0x0D145000 + 0 + 0 = 0x0D145000
#DEFINE DOOR_CLOSED_CAN_ID 0x0D145000
;mCarLight 4 FRONT DOWN = 0xf10b900 + 3*4 + 0*2 + 1 = 0xf10b90d
#DEFINE CAR_LIGHT_4FD_CAN_ID 0xf10b90d
;message period
#DEFINE MESSAGE_PERIOD 0.1s

;checks have to come 3 periods after the values are set to be sure they have propagated

;intialize
;PHYSICAL MESSAGE INJECTION
;time type period context payload param param ... = arg arg ...
0s I MESSAGE_PERIOD F HallCall 4 FRONT DOWN = false

;NETWORK MESSAGE INJECTION
;time type period context msgid translator param param ... = arg arg ...
0s I MESSAGE_PERIOD N DOOR_CLOSED_CAN_ID DoorClosed FRONT LEFT = true

;check that the light is off initially
;ASSERTION TO CHECK PHYSICAL MESSAGE
;time type context payload param param ... : member operator value
0.21s A F HallLight 4 FRONT DOWN : lighted == false

;ASSERTION TO CHECK NETWORK MESSAGE
;time type context type translator param param ... : member operator value
0.21s A N CAR_LIGHT_4FD_CAN_ID Boolean : getValue == false

;TL.T.1
;check that the light is on
0.71s A F HallLight 4 FRONT DOWN : lighted == true
0.71s A N CAR_LIGHT_4FD_CAN_ID Boolean : getValue == true

;TL.T.2
;check that the light is off
1.21s A F HallLight 4 FRONT DOWN : lighted == false
1.21s A N CAR_LIGHT_4FD_CAN_ID Boolean : getValue == false

;set conditions for TL.T.4
1.40s I MESSAGE_PERIOD N DOOR_CLOSED_CAN_ID DoorClosed FRONT LEFT = false

....