Skip to content

Commit

Permalink
Impved Mul/Div test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
turboladen committed Aug 20, 2024
1 parent 7fabe4d commit bcd98a9
Show file tree
Hide file tree
Showing 4 changed files with 437 additions and 83 deletions.
10 changes: 10 additions & 0 deletions crates/api/src/measurement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ impl Measurement {
self.scalar() / other_unit.reduce_value(One::one())
}
}

/// Intended for comparing `Unit`s or `Measurements`, when the order of the `Term`s in a `Unit`
/// don't hold order (they're not sorted) after some operations. This allows tests to sort them
/// and thus tests to have valid expectations.
///
#[cfg(test)]
pub(crate) fn sort_terms(&mut self) -> &mut Self {
let _ = self.unit.sort_terms();
self
}
}

impl AsRef<Self> for Measurement {
Expand Down
Loading

0 comments on commit bcd98a9

Please sign in to comment.