35 lines
1 KiB
Rust
35 lines
1 KiB
Rust
use flowrs_core::graph::widget::{CodegenContext, builtin_registry};
|
|
use std::collections::HashMap;
|
|
|
|
#[test]
|
|
fn emit() {
|
|
for w in builtin_registry().all() {
|
|
let id = w.id();
|
|
if !(id.starts_with("embedded.")
|
|
|| id.starts_with("video.")
|
|
|| id == "ai.object_detect"
|
|
|| id == "twin.capture")
|
|
{
|
|
continue;
|
|
}
|
|
let ctx = CodegenContext {
|
|
var_names: HashMap::new(),
|
|
imports: vec![],
|
|
state_fields: vec![],
|
|
profile: flowrs_core::graph::Profile::scientific(),
|
|
params: w
|
|
.parameters()
|
|
.into_iter()
|
|
.map(|p| (p.name, p.default))
|
|
.collect(),
|
|
};
|
|
let inputs = w
|
|
.inputs()
|
|
.into_iter()
|
|
.map(|p| (p.name.clone(), format!("in_{}", p.name)))
|
|
.collect();
|
|
let r = w.codegen(&ctx, inputs);
|
|
println!("### {id} imports={:?}", r.imports);
|
|
println!("{}", r.process);
|
|
}
|
|
}
|