Skip to content

Commit

Permalink
rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-q committed Apr 29, 2024
1 parent 65b8c1a commit 920269f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions hugr/src/hugr/serialize/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,6 @@ fn hierarchy_order() -> Result<(), Box<dyn std::error::Error>> {
}

#[test]
#[cfg_attr(miri, ignore = "Extension ops cannot be used with miri.")]
// Miri doesn't run the extension registration required by `typetag` for registering `CustomConst`s.
// https://github.com/rust-lang/miri/issues/450
fn constants_roundtrip() -> Result<(), Box<dyn std::error::Error>> {
let mut builder = DFGBuilder::new(FunctionType::new(vec![], vec![FLOAT64_TYPE])).unwrap();
let w = builder.add_load_value(ConstF64::new(0.5));
Expand All @@ -314,6 +311,24 @@ fn constants_roundtrip() -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}

#[test]
fn serialize_types_roundtrip() {
let g: Type = Type::new_function(FunctionType::new_endo(vec![]));

assert_eq!(ser_roundtrip(&g), g);

// A Simple tuple
let t = Type::new_tuple(vec![USIZE_T, g]);
assert_eq!(ser_roundtrip(&t), t);

// A Classic sum
let t = Type::new_sum([type_row![USIZE_T], type_row![FLOAT64_TYPE]]);
assert_eq!(ser_roundtrip(&t), t);

let t = Type::new_unit_sum(4);
assert_eq!(ser_roundtrip(&t), t);
}

fn check_testing_roundtrip<T: Serialize + DeserializeOwned>(t: T) {
ser_roundtrip_validate(&Versioned::new(t), Some(&TESTING_SCHEMA));
}
Expand Down

0 comments on commit 920269f

Please sign in to comment.