diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-01-08 22:57:31 +1100 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-01-09 15:41:46 +1100 |
| commit | ceea85a148ec3426edfc00b8353a19c1d2df5dbf (patch) | |
| tree | 34005cf06fde432a44cff41aca0a6603b12cf3a4 /src/libextra | |
| parent | 7613b15fdbbb9bf770a2c731f4135886b0ff3cf0 (diff) | |
| download | rust-ceea85a148ec3426edfc00b8353a19c1d2df5dbf.tar.gz rust-ceea85a148ec3426edfc00b8353a19c1d2df5dbf.zip | |
Remove ApproxEq and assert_approx_eq!
This trait seems to stray too far from the mandate of a standard library as implementations may vary between use cases.
Diffstat (limited to 'src/libextra')
| -rw-r--r-- | src/libextra/num/complex.rs | 2 | ||||
| -rw-r--r-- | src/libextra/stats.rs | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/libextra/num/complex.rs b/src/libextra/num/complex.rs index 58af80fefb7..b4795c7e66b 100644 --- a/src/libextra/num/complex.rs +++ b/src/libextra/num/complex.rs @@ -268,7 +268,7 @@ mod test { #[test] fn test_arg() { fn test(c: Complex64, arg: f64) { - assert!(c.arg().approx_eq(&arg)) + assert!((c.arg() - arg).abs() < 1.0e-6) } test(_1_0i, 0.0); test(_1_1i, 0.25 * Real::pi()); diff --git a/src/libextra/stats.rs b/src/libextra/stats.rs index f95c12904ff..7b2dcc53b79 100644 --- a/src/libextra/stats.rs +++ b/src/libextra/stats.rs @@ -439,6 +439,14 @@ mod tests { use std::io; use std::str; + macro_rules! assert_approx_eq( + ($a:expr, $b:expr) => ({ + let (a, b) = (&$a, &$b); + assert!((*a - *b).abs() < 1.0e-6, + "{} is not approximately equal to {}", *a, *b); + }) + ) + fn check(samples: &[f64], summ: &Summary) { let summ2 = Summary::new(samples); |
