Files
@ 2c25a85d3cc2
Branch filter:
Location: CSY/reowolf/src/runtime2/tests/mod.rs - annotation
2c25a85d3cc2
1.6 KiB
application/rls-services+xml
WIP: Fix scheduling and message transfer bug
53d3950d9b6b 53d3950d9b6b 53d3950d9b6b bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 bf4c0ee5ba65 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 53d3950d9b6b 0781cf1b7abf bf4c0ee5ba65 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 2c25a85d3cc2 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf 0781cf1b7abf bf4c0ee5ba65 53d3950d9b6b | use crate::protocol::*;
use crate::protocol::eval::*;
use crate::runtime2::runtime::*;
use crate::runtime2::component::{CompCtx, CompPDL};
fn create_component(rt: &Runtime, module_name: &str, routine_name: &str, args: ValueGroup) {
let prompt = rt.inner.protocol.new_component(
module_name.as_bytes(), routine_name.as_bytes(), args
).expect("create prompt");
let reserved = rt.inner.start_create_pdl_component();
let ctx = CompCtx::new(&reserved);
let (key, _) = rt.inner.finish_create_pdl_component(reserved, CompPDL::new(prompt, 0), ctx, false);
rt.inner.enqueue_work(key);
}
fn no_args() -> ValueGroup { ValueGroup::new_stack(Vec::new()) }
#[test]
fn test_component_creation() {
let pd = ProtocolDescription::parse(b"
primitive nothing_at_all() {
s32 a = 5;
auto b = 5 + a;
}
").expect("compilation");
let rt = Runtime::new(1, pd);
for i in 0..20 {
create_component(&rt, "", "nothing_at_all", no_args());
}
}
#[test]
fn test_component_communication() {
let pd = ProtocolDescription::parse(b"
primitive sender(out<u32> o) {
print(\"sender\");
sync put(o, 1);
}
primitive receiver(in<u32> i) {
print(\"receiver\");
sync auto a = get(i);
}
composite constructor() {
channel o -> i;
print(\"creating sender\");
new sender(o);
print(\"creating receiver\");
new receiver(i);
print(\"done\");
}
").expect("compilation");
let rt = Runtime::new(1, pd);
create_component(&rt, "", "constructor", no_args());
}
|