use rust_decimal::Decimal;
use rust_decimal_macros::dec;

use super::approx_eq_dec;

#[test]
fn almost_should_be_considered_equal() {
    const TOLERANCE: Decimal = dec!(0.08);

    assert!(approx_eq_dec(&dec!(0.05), &dec!(0), TOLERANCE));
}

#[test]
fn exact_should_be_considered_equal() {
    const TOLERANCE: Decimal = dec!(0.00);

    assert!(approx_eq_dec(&dec!(0), &dec!(0), TOLERANCE));
}

#[test]
fn almost_with_precise_tolerance_should_be_considered_equal() {
    const TOLERANCE: Decimal = dec!(0.05);

    assert!(approx_eq_dec(&dec!(0.05), &dec!(0), TOLERANCE));
}
