test: use almost::zero instead of almost::equal as per documentation
"Do not use this to compare a value with a constant zero. Instead, for this you should use almost::zero."
This commit is contained in:
parent
8b52592f2d
commit
672f9047a2
1 changed files with 6 additions and 7 deletions
|
|
@ -145,7 +145,6 @@ pub fn is_valid_srgb(c: Srgba) -> bool {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use almost::equal;
|
|
||||||
use palette::{OklabHue, Srgba};
|
use palette::{OklabHue, Srgba};
|
||||||
|
|
||||||
use super::{is_valid_srgb, oklch_to_srgba_nearest_chroma};
|
use super::{is_valid_srgb, oklch_to_srgba_nearest_chroma};
|
||||||
|
|
@ -173,16 +172,16 @@ mod tests {
|
||||||
fn test_conversion_boundaries() {
|
fn test_conversion_boundaries() {
|
||||||
let c1 = palette::Oklcha::new(0.0, 0.288, OklabHue::from_degrees(0.0), 1.0);
|
let c1 = palette::Oklcha::new(0.0, 0.288, OklabHue::from_degrees(0.0), 1.0);
|
||||||
let srgb = oklch_to_srgba_nearest_chroma(c1);
|
let srgb = oklch_to_srgba_nearest_chroma(c1);
|
||||||
equal(srgb.red, 0.0);
|
almost::zero(srgb.red);
|
||||||
equal(srgb.blue, 0.0);
|
almost::zero(srgb.blue);
|
||||||
equal(srgb.green, 0.0);
|
almost::zero(srgb.green);
|
||||||
|
|
||||||
let c1 = palette::Oklcha::new(1.0, 0.288, OklabHue::from_degrees(0.0), 1.0);
|
let c1 = palette::Oklcha::new(1.0, 0.288, OklabHue::from_degrees(0.0), 1.0);
|
||||||
let srgb = oklch_to_srgba_nearest_chroma(c1);
|
let srgb = oklch_to_srgba_nearest_chroma(c1);
|
||||||
|
|
||||||
equal(srgb.red, 1.0);
|
almost::equal(srgb.red, 1.0);
|
||||||
equal(srgb.blue, 1.0);
|
almost::equal(srgb.blue, 1.0);
|
||||||
equal(srgb.green, 1.0);
|
almost::equal(srgb.green, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue