# "channel-test-c-13.prsimrc"
# @haco@ channel-test-c.haco-a
# @deps@ channel-test-a-values-X.txt

# echo-commands on
watchall
source channel-test-c-01.prsimrc

channel-source X channel-test-a-values-X.txt
channel-show X
echo why-x: X is sourced, should be able to trace back through acknowledge
why-x X.v
why-x-verbose X.v

echo - - - - - - - - - - - - - - - - - - -
echo resetting channel X
channel-reset X
cycle
assert X.v 0
why-not X.v
why X.v
why-not-verbose X.v
why-verbose X.v

echo - - - - - - - - - - - - - - - - - - -
echo releasing channel X, but ack is still X
channel-release X
# watchall
cycle
# we know the first values sourced
assert X.v X
why-x X.v
why-x-verbose X.v

echo - - - - - - - - - - - - - - - - - - -
echo reset ack
set X.e 0
cycle
# we know the first values sourced
assert X.v 0
why-not X.v
why X.v
why-not-verbose X.v
why-verbose X.v

echo - - - - - - - - - - - - - - - - - - -
echo set ack
set X.e 1
cycle
# we know the first values sourced
assert X.d[0] 1
assert X.d[1] 0
assert X.v 1
why-not X.d[0]
why-not X.d[1]
why-not X.v
why-not-verbose X.d[0]
why-not-verbose X.d[1]
why-not-verbose X.v
why-verbose X.d[0]
why-verbose X.d[1]
why-verbose X.v

echo - - - - - - - - - - - - - - - - - - -
echo reset ack
set X.e 0
cycle
# we know the first values sourced
assert X.d[0] 0
assert X.d[1] 0
assert X.v 0
why-not X.v
why-not-verbose X.v
why-verbose X.v

echo - - - - - - - - - - - - - - - - - - -
echo set ack
set X.e 1
cycle
# we know the second values sourced
assert X.d[0] 0
assert X.d[1] 1
assert X.v 1
why-not X.v
why-not-verbose X.v
why-verbose X.v

echo - - - - - - - - - - - - - - - - - - -
channel-stop X
echo freezing channel X, and setting ack
set X.e 0
cycle
channel-show X
assert X.d[0] 0
assert X.d[1] 1
assert X.v 1
why-not X.d[0]
why-not X.d[1]
why-not X.v
why-not-verbose X.d[0]
why-not-verbose X.d[1]
why-not-verbose X.v
why-verbose X.d[0]
why-verbose X.d[1]
why-verbose X.v

echo - - - - - - - - - - - - - - - - - - -
channel-release X
echo releasing channel X
cycle
assert X.d[0] 0
assert X.d[1] 0
assert X.e 0

echo - - - - - - - - - - - - - - - - - - -
echo setting X.e -> U
set X.e X
cycle
channel-show X
assert X.d[0] X
assert X.d[1] X
assert X.v X
why-x X.v
why-x-verbose X.v
# why-not X.v
# why X.v

echo - - - - - - - - - - - - - - - - - - -
echo setting X.e -> 1
set X.e 1
step-event
assert X.d[0] X
assert X.d[1] X
assert X.v X
why-not X.d[0] 1
why-not X.d[0] 0
why-not X.d[1] 1
why-not X.d[1] 0
queue
time
cycle
assert X.d[0] 0
assert X.d[1] 1
assert X.v 1

echo - - - - - - - - - - - - - - - - - - -
echo ack-ing X.e
set X.e 0
step-event
queue
time
why-not X.d[0]
why-not X.d[1]
why-not-verbose X.d[0]
why-not-verbose X.d[1]
why-verbose X.d[0]
why-verbose X.d[1]
cycle
assert X.d[0] 0
assert X.d[1] 0
assert X.v 0

echo DONE.

