diff --git a/src/runtime/tests.rs b/src/runtime/tests.rs index 17a6aac7bc715623c08fbdf995688b6dfc39c7e2..b9cf20cd3d9a847e5d489335d4b310605476d26c 100644 --- a/src/runtime/tests.rs +++ b/src/runtime/tests.rs @@ -37,9 +37,9 @@ fn file_logged_configured_connector( Connector::new(file_logger, pd, connector_id) } static MINIMAL_PDL: &'static [u8] = b" -primitive sync(in a, out b) { +primitive sync_component(in a, out b) { while (true) { - synchronous { + sync { if (fires(a) && fires(b)) { msg x = get(a); put(b, x); @@ -51,7 +51,7 @@ primitive sync(in a, out b) { } primitive together(in ia, in ib, out oa, out ob){ - while(true) synchronous { + while(true) sync { if(fires(ia)) { put(oa, get(ia)); put(ob, get(ib)); @@ -102,7 +102,7 @@ fn new_sync() { let test_log_path = Path::new("./logs/new_sync"); let mut c = file_logged_connector(0, test_log_path); let [o, i] = c.new_port_pair(); - c.add_component(b"", b"sync", &[i, o]).unwrap(); + c.add_component(b"", b"sync_component", &[i, o]).unwrap(); } #[test] @@ -353,7 +353,7 @@ fn cannot_use_moved_ports() { let test_log_path = Path::new("./logs/cannot_use_moved_ports"); let mut c = file_logged_connector(0, test_log_path); let [p, g] = c.new_port_pair(); - c.add_component(b"", b"sync", &[g, p]).unwrap(); + c.add_component(b"", b"sync_component", &[g, p]).unwrap(); c.connect(SEC1).unwrap(); c.put(p, TEST_MSG.clone()).unwrap_err(); c.get(g).unwrap_err(); @@ -369,7 +369,7 @@ fn sync_sync() { let mut c = file_logged_connector(0, test_log_path); let [p0, g0] = c.new_port_pair(); let [p1, g1] = c.new_port_pair(); - c.add_component(b"", b"sync", &[g0, p1]).unwrap(); + c.add_component(b"", b"sync_component", &[g0, p1]).unwrap(); c.connect(SEC1).unwrap(); c.put(p0, TEST_MSG.clone()).unwrap(); c.get(g1).unwrap(); @@ -421,7 +421,7 @@ fn distributed_msg_bounce() { c.new_net_port(Putter, sock_addrs[0], Active).unwrap(), c.new_net_port(Getter, sock_addrs[1], Active).unwrap(), ]; - c.add_component(b"", b"sync", &[g, p]).unwrap(); + c.add_component(b"", b"sync_component", &[g, p]).unwrap(); c.connect(SEC1).unwrap(); c.sync(SEC1).unwrap(); }); @@ -882,7 +882,7 @@ fn ac_not_b() { let pdl = b" primitive ac_not_b(in a, in b, out c){ // forward A to C but keep B silent - synchronous{ put(c, get(a)); } + sync { put(c, get(a)); } }"; let pd = Arc::new(reowolf::ProtocolDescription::parse(pdl).unwrap()); let mut c = file_logged_configured_connector(1, test_log_path, pd); @@ -946,7 +946,7 @@ fn many_rounds_mem() { fn pdl_reo_lossy() { let pdl = b" primitive lossy(in a, out b) { - while(true) synchronous { + while(true) sync { msg m = null; if(fires(a)) { m = get(a); @@ -965,7 +965,7 @@ fn pdl_reo_fifo1() { let pdl = b" primitive fifo1(in a, out b) { msg m = null; - while(true) synchronous { + while(true) sync { if(m == null) { if(fires(a)) m=get(a); } else { @@ -985,7 +985,7 @@ fn pdl_reo_fifo1full() { primitive fifo1full(in a, out b) { bool is_set = true; msg m = create(0); - while(true) synchronous { + while(true) sync { if(!is_set) { if(fires(a)) m=get(a); is_set = false; @@ -1012,7 +1012,7 @@ fn pdl_msg_consensus() { let test_log_path = Path::new("./logs/pdl_msg_consensus"); let pdl = b" primitive msgconsensus(in a, in b) { - while(true) synchronous { + while(true) sync { msg x = get(a); msg y = get(b); assert(x == y); @@ -1040,7 +1040,7 @@ fn sequencer3_prim() { let pdl = b" primitive sequencer3(out a, out b, out c) { u32 i = 0; - while(true) synchronous { + while(true) sync { out to = a; if (i==1) to = b; else if(i==2) to = c; @@ -1087,7 +1087,7 @@ fn sequencer3_comp() { let pdl = b" primitive replicator(in a, out b, out c) { while (true) { - synchronous { + sync { if (fires(a) && fires(b) && fires(c)) { msg x = get(a); put(b, x); @@ -1099,7 +1099,7 @@ fn sequencer3_comp() { } } primitive fifo1_init(bool has_value, T m, in a, out b) { - while(true) synchronous { + while(true) sync { if(has_value && fires(b)) { put(b, m); has_value = false; @@ -1181,7 +1181,7 @@ fn xrouter_prim() { let test_log_path = Path::new("./logs/xrouter_prim"); let pdl = b" primitive xrouter(in a, out b, out c) { - while(true) synchronous { + while(true) sync { if(fires(a)) { if(fires(b)) put(b, get(a)); else put(c, get(a)); @@ -1222,7 +1222,7 @@ fn xrouter_comp() { let pdl = b" primitive replicator(in a, out b, out c) { while (true) { - synchronous { + sync { if (fires(a) && fires(b) && fires(c)) { msg x = get(a); put(b, x); @@ -1236,7 +1236,7 @@ fn xrouter_comp() { primitive merger(in a, in b, out c) { while (true) { - synchronous { + sync { if (fires(a) && !fires(b) && fires(c)) { put(c, get(a)); } else if (!fires(a) && fires(b) && fires(c)) { @@ -1249,7 +1249,7 @@ fn xrouter_comp() { } primitive lossy(in a, out b) { - while(true) synchronous { + while(true) sync { if(fires(a)) { auto m = get(a); if(fires(b)) put(b, m); @@ -1257,7 +1257,7 @@ fn xrouter_comp() { } } primitive sync_drain(in a, in b) { - while(true) synchronous { + while(true) sync { if(fires(a)) { msg drop_it = get(a); msg on_the_floor = get(b); @@ -1320,7 +1320,7 @@ fn count_stream() { primitive count_stream(out o) { msg m = create(1); m[0] = 0; - while(true) synchronous { + while(true) sync { put(o, m); m[0] += 1; } @@ -1351,7 +1351,7 @@ fn for_msg_byte() { while(i<8) { msg m = create(1); m[idx] = i; - synchronous put(o, m); + sync put(o, m); i += 1; } } @@ -1379,7 +1379,7 @@ fn eq_causality() { primitive eq(in a, in b, out c) { msg ma = create(0); msg mb = create(0); - while(true) synchronous { + while(true) sync { if(fires(a)) { // b and c also fire! // left first! @@ -1435,7 +1435,7 @@ fn eq_no_causality() { primitive eqinner(in a, in b, out c, out leftfirsto, in leftfirsti) { msg ma = create(0); msg mb = create(0); - while(true) synchronous { + while(true) sync { if(fires(a)) { // b and c also fire! if(fires(leftfirsti)) {