diff --git a/src/runtime2/tests/mod.rs b/src/runtime2/tests/mod.rs index 6583f36c165d9eb7156bf872c743371240a15fc8..b139ad3ad26b8119bccdbfb57b8b0377e01e9578 100644 --- a/src/runtime2/tests/mod.rs +++ b/src/runtime2/tests/mod.rs @@ -5,6 +5,17 @@ use crate::runtime2::component::{CompCtx, CompPDL}; mod error_handling; +const NUM_THREADS: u32 = 1; +const DEBUG_LOGGING: bool = true; + +pub(crate) fn compile_and_create_component(source: &str, routine_name: &str, args: ValueGroup) { + let protocol = ProtocolDescription::parse(source.as_bytes()) + .expect("successful compilation"); + let runtime = Runtime::new(NUM_THREADS, DEBUG_LOGGING, protocol) + .expect("successful runtime startup"); + create_component(&runtime, "", routine_name, args); +} + pub(crate) 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