Skip to main content

assert_equal

Macro assert_equal 

Source
macro_rules! assert_equal {
    ($a:expr, $b:expr) => { ... };
}
Expand description

Asserts exact equality between two floating-point numbers.

§Arguments

  • a - The first floating-point number to compare.
  • b - The second floating-point number to compare against.

§Panics

If the two floating-point numbers are not exactly equal.

§Note

See Compare::is_equal for details on how exact equality is defined.

§Examples

use numtest::*;

assert_equal!(2.0, 2.0)
use numtest::*;

assert_equal!(f64::NAN, f64::NAN)
use numtest::*;

assert_equal!(2.0, 2.01)