use futuresdr::anyhow::Result; use futuresdr::blocks::Copy; use futuresdr::blocks::Head; use futuresdr::blocks::NullSource; use futuresdr::blocks::VectorSink; use futuresdr::blocks::VectorSinkBuilder; use futuresdr::runtime::scheduler::TpbScheduler; use futuresdr::runtime::Flowgraph; use futuresdr::runtime::Runtime; #[test] fn flowgraph_tpb() -> Result<()> { let mut fg = Flowgraph::new(); let copy = Copy::::new(); let head = Head::::new(1_000_000); let null_source = NullSource::::new(); let vect_sink = VectorSinkBuilder::::new().build(); let copy = fg.add_block(copy); let head = fg.add_block(head); let null_source = fg.add_block(null_source); let vect_sink = fg.add_block(vect_sink); fg.connect_stream(null_source, "out", head, "in")?; fg.connect_stream(head, "out", copy, "in")?; fg.connect_stream(copy, "out", vect_sink, "in")?; fg = Runtime::with_scheduler(TpbScheduler::new()).run(fg)?; let snk = fg.kernel::>(vect_sink).unwrap(); let v = snk.items(); assert_eq!(v.len(), 1_000_000); for i in v { assert!(i.abs() < f32::EPSILON); } Ok(()) }