# Exercise: Channel Operation Results
#
# Channel operations return success/failure status:
#
# chan.send    ( value Channel -- Bool )
#   Returns true if sent, false if channel closed
#
# chan.receive ( Channel -- value Bool )
#   Returns (value true) if received, or (dummy false) if closed
#
# This lets you handle closed channels gracefully.
#
# Your task: Send a value, then receive it and check the status.
# When done, delete the marker line below.

# I AM NOT DONE

: test-safe-ops ( -- )
    chan.make
    dup 99 swap chan.send drop   # send returns Bool, drop it
    # Your code here: receive from the channel. You should get
    # back the value along with a success status (true).
    drop 0 false
    # Do not edit below this line
    test.assert         # Status should be true
    99 test.assert-eq   # Value should be 99
;
