Skip to content

Commit

Permalink
test: &Hugr is HugrView
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-q committed Nov 28, 2024
1 parent 7177c5f commit 69db594
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions hugr-core/src/hugr/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,3 +648,27 @@ where
P: Into<Port> + Copy,
{
}

#[cfg(test)]
mod test {
use crate::{builder::test::simple_dfg_hugr, hugr::HugrMut, Hugr, HugrView};

#[test]
fn hugr_ref_is_hugr_view() {
let hugr = simple_dfg_hugr();

let hugr_ref: &Hugr = &hugr;

let _ = <&Hugr as HugrView>::root(&hugr_ref);
}

#[test]
fn hugr_mut_ref_is_hugr_mut() {
let mut hugr = simple_dfg_hugr();
let root = hugr.root();

let mut hugr_mut_ref: &mut Hugr = &mut hugr;

let _ = <&mut Hugr as HugrMut>::set_metadata(&mut hugr_mut_ref, root, "proof", true);
}
}

0 comments on commit 69db594

Please sign in to comment.