diff --git a/src/runtime2/tests/mod.rs b/src/runtime2/tests/mod.rs index 2a481ff71dd208cea4ea0b3705c1192256b281a3..08d0f0d2e0ec7f261091cf9ff020c3fc3bbad532 100644 --- a/src/runtime2/tests/mod.rs +++ b/src/runtime2/tests/mod.rs @@ -84,6 +84,52 @@ fn test_component_communication() { create_component(&rt, "", "constructor", no_args()); } +#[test] +fn test_intermediate_messenger() { + let pd = ProtocolDescription::parse(b" + primitive receiver(in rx, u32 num) { + auto index = 0; + while (index < num) { + sync { auto v = get(rx); } + index += 1; + } + } + + primitive middleman(in rx, out tx, u32 num) { + auto index = 0; + while (index < num) { + sync { put(tx, get(rx)); } + index += 1; + } + } + + primitive sender(out tx, u32 num) { + auto index = 0; + while (index < num) { + sync put(tx, 1337); + index += 1; + } + } + + composite constructor_template() { + auto num = 0; + channel tx_a -> rx_a; + channel tx_b -> rx_b; + new sender(tx_a, 1); + new middleman(rx_a, tx_b, 2); + new receiver(rx_b, 3); + } + + composite constructor() { + new constructor_template(); + // new constructor_template(); + // new constructor_template(); + } + ").expect("compilation"); + let rt = Runtime::new(1, true, pd); + create_component(&rt, "", "constructor", no_args()); +} + #[test] fn test_simple_select() { let pd = ProtocolDescription::parse(b"