diff --git a/src/runtime2/tests/mod.rs b/src/runtime2/tests/mod.rs index 2a481ff71dd208cea4ea0b3705c1192256b281a3..a316a1561c391dd2207cc46779f1acfeb2834c14 100644 --- a/src/runtime2/tests/mod.rs +++ b/src/runtime2/tests/mod.rs @@ -84,6 +84,55 @@ 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, 3); + new middleman(rx_a, tx_b, 3); + new receiver(rx_b, 3); + } + + composite constructor() { + new constructor_template(); + new constructor_template(); + new constructor_template(); + new constructor_template(); + new constructor_template(); + new constructor_template(); + } + ").expect("compilation"); + let rt = Runtime::new(3, true, pd); + create_component(&rt, "", "constructor", no_args()); +} + #[test] fn test_simple_select() { let pd = ProtocolDescription::parse(b"