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

use crate::test::ApproxEq;

impl ApproxEq for Decimal {
    type Tolerance = Decimal;

    fn default_tolerance() -> Self::Tolerance {
        dec!(0.1)
    }

    fn approx_eq_tolerance(&self, other: &Self, tolerance: Self::Tolerance) -> bool {
        super::approx_eq_dec(self, other, tolerance)
    }
}
