Skip to content

Commit

Permalink
Improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana-s committed Dec 11, 2024
1 parent e1ac29a commit 36ad0a0
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions hugr-core/src/extension/prelude/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ mod tests {
ops::{constant, OpType},
type_row,
types::TypeArg,
OutgoingPort,
HugrView, OutgoingPort,
};

use super::LoadNat;
Expand All @@ -179,9 +179,19 @@ mod tests {
let arg = TypeArg::BoundedNat { n: 4 };
let op = LoadNat::new(arg);

let out = b.add_dataflow_op(op, []).unwrap();
let out = b.add_dataflow_op(op.clone(), []).unwrap();

b.finish_hugr_with_outputs(out.outputs()).unwrap();
let result = b.finish_hugr_with_outputs(out.outputs()).unwrap();

let exp_optype: OpType = op.into();

for child in result.children(result.root()) {
let node_optype = result.get_optype(child);
// The only node in the HUGR besides Input and Output should be LoadNat.
if !node_optype.is_input() && !node_optype.is_output() {
assert_eq!(node_optype, &exp_optype)
}
}
}

#[test]
Expand Down

0 comments on commit 36ad0a0

Please sign in to comment.