Skip to content

Commit

Permalink
fix: Fix broken ConstAngle::TAU (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
doug-q authored Sep 12, 2024
1 parent 8d7a90b commit 86972f8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tket2/src/extension/angle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl ConstAngle {
/// The constant π
pub const PI: Self = Self::new_unchecked(1, 1);
/// The constant 2π
pub const TAU: Self = Self::new_unchecked(0, 1);
pub const TAU: Self = Self::new_unchecked(0, 0);
/// The constant π/2
pub const PI_2: Self = Self::new_unchecked(2, 1);
/// The constant π/4
Expand Down Expand Up @@ -411,4 +411,12 @@ mod test {

let _hugr = builder.finish_hugr_with_outputs([bool], &REGISTRY).unwrap();
}

#[rstest::rstest]
fn const_angle_statics(
#[values(ConstAngle::TAU, ConstAngle::PI, ConstAngle::PI_2, ConstAngle::PI_4)]
konst: ConstAngle,
) {
assert_eq!(ConstAngle::new(konst.log_denom(), konst.value()), Ok(konst));
}
}

0 comments on commit 86972f8

Please sign in to comment.