use uor_foundation::enforcement::{
ConstrainedTypeInput, InteractionDeclarationBuilder, InteractionShape, Validated,
};
use uor_foundation::pipeline::{
run_interactive, run_parallel, run_stream, InteractionDeclaration, InteractionDriver,
ParallelDeclaration, StreamDeclaration, StreamDriver,
};
use uor_foundation_test_helpers::{validated_runtime, Fnv1aHasher16, REFERENCE_INLINE_BYTES as N};
#[test]
fn phase_m_run_stream_returns_named_sealed_stream_driver() {
let unit: Validated<StreamDeclaration<'static, N>> =
validated_runtime(StreamDeclaration::new::<ConstrainedTypeInput>(2));
let driver: StreamDriver<ConstrainedTypeInput, _, Fnv1aHasher16, N, 32> = run_stream(unit);
let _ = driver;
}
#[test]
fn phase_m_run_parallel_returns_result_grounded() {
static PARTITION: &[u32] = &[0, 1, 2];
let unit: Validated<ParallelDeclaration> =
validated_runtime(ParallelDeclaration::new_with_partition::<
ConstrainedTypeInput,
>(
PARTITION,
"https://uor.foundation/parallel/ParallelDisjointnessWitness",
));
let result = run_parallel::<ConstrainedTypeInput, _, Fnv1aHasher16, N, 32>(unit)
.expect("parallel walks");
let _ = result;
}
#[test]
fn phase_m_run_interactive_returns_named_sealed_interaction_driver() {
let unit: Validated<InteractionDeclaration> =
validated_runtime(InteractionDeclaration::new::<ConstrainedTypeInput>(42));
let driver: InteractionDriver<ConstrainedTypeInput, _, Fnv1aHasher16, N, 32> =
run_interactive(unit);
let _ = driver;
}
#[test]
fn phase_m_drivers_have_named_return_types() {
use uor_foundation::enforcement::Runtime;
let _run_stream_ty: fn(
Validated<StreamDeclaration<'static, N>, Runtime>,
)
-> StreamDriver<ConstrainedTypeInput, Runtime, Fnv1aHasher16, N, 32> = run_stream;
let _run_interactive_ty: fn(
Validated<InteractionDeclaration, Runtime>,
) -> InteractionDriver<
ConstrainedTypeInput,
Runtime,
Fnv1aHasher16,
N,
> = run_interactive;
}
#[test]
fn phase_m_interaction_declaration_builder_shape_roundtrip() {
let builder = InteractionDeclarationBuilder::new()
.peer_protocol(1)
.convergence_predicate(2)
.commutator_state_class(3);
let shape: Validated<InteractionShape> = builder.validate().expect("validates");
let _ = shape;
}