added Choice ship
[fleet.git] / tests / choice / demux-test.fleet
diff --git a/tests/choice/demux-test.fleet b/tests/choice/demux-test.fleet
new file mode 100644 (file)
index 0000000..553c159
--- /dev/null
@@ -0,0 +1,68 @@
+// expected output
+#expect 2
+#expect 1
+
+#expect 1
+#expect 2
+
+#expect 1
+#expect 1
+#expect 2
+
+#expect 2
+#expect 2
+#expect 1
+
+#expect 2
+#expect 1
+#expect 1
+
+#expect 1
+#expect 2
+#expect 2
+
+// ships required in order to run this code
+#ship debug        : Debug
+#ship fifo         : Fifo
+#ship fifo1        : Fifo
+#ship fifo2        : Fifo
+#ship choice       : Choice
+
+// alternate values from choice1+choice2
+choice.out1: [*] take, notify fifo1.out;
+choice.out2: [*] take, notify fifo2.out;
+debug.in:    [*] take, deliver, notify fifo.out;
+
+choice.in1: take; [*] deliver;
+1:          sendto choice.in1;
+
+// choice.in2 should never be used (FIXME: test this)
+
+choice.in:  [*] take, deliver;
+
+0:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfZero;
+1:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfZero;
+0:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNonZero;
+1:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNonZero;
+-1: sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfPositive;
+0:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfPositive;
+1:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfPositive;
+-1: sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNonPositive;
+0:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNonPositive;
+1:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNonPositive;
+-1: sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNegative;
+0:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNegative;
+1:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNegative;
+-1: sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNonNegative;
+0:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNonNegative;
+1:  sendto fifo.in;  fifo.out: wait, take, sendto choice.in.deMuxIfNonNegative;
+0: sendto fifo.out;
+fifo.in: [*] take, deliver;
+
+1: sendto fifo1.in;
+fifo1.in: take, deliver;
+fifo1.out: take; [*] wait, sendto debug.in;
+
+2: sendto fifo2.in;
+fifo2.in: take, deliver;
+fifo2.out: take; [*] wait, sendto debug.in;