-- Buffer
-- adapted from standard FDR2 example

datatype FRUIT = apples | oranges | pears

channel left,right,mid: FRUIT
channel ack

SEND = left ? x -> mid ! x -> ack -> SEND

REC = mid ? x -> right ! x -> ack -> REC

SYSTEM = (SEND [| {|mid,ack|} |] REC) \ {| mid,ack |}

GEN1 = left!oranges -> right!oranges -> GEN2
GEN2 = left!pears -> right!pears -> GEN1

MAIN = SYSTEM [| {| left,right |} |] GEN1

{- Test = (ack -> left!apples -> STOP) \ {|ack|} -}

-- Trace Check Generated by ProB:
PROB_TEST_TRACE = left.oranges -> right.oranges -> left.pears -> right.pears -> left.oranges -> right.oranges -> STOP

assert MAIN [T= PROB_TEST_TRACE
