Skip to content

Commit 7c37e62

Browse files
committed
Update test utils
1 parent 6479271 commit 7c37e62

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

tests/utils.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// Assert if A is equal to B within an acceptable margin of error (tol)
2-
pub fn assert_eq_f_vec(a: &Vec<f64>, b: &Vec<f64>, tol: f64) {
2+
pub fn assert_eq_f_vec<T: rsparse::data::Numeric<T>>(a: &Vec<T>, b: &Vec<T>, tol: T) {
33
for i in 0..a.len() {
4-
let diff = f64::abs(a[i] - b[i]);
4+
let diff = T::abs(a[i] - b[i]);
55
if diff > tol {
66
panic!(
77
"The Vec are not equal: {:?} != {:?}. -- Check failed by: {}",
@@ -75,10 +75,10 @@ fn assert_eq_f_vec_2(){
7575
}
7676

7777
/// Assert if A is equal to B within an acceptable margin of error (tol)
78-
pub fn assert_eq_f2d_vec(a: &Vec<Vec<f64>>, b: &Vec<Vec<f64>>, tol: f64) {
78+
pub fn assert_eq_f2d_vec<T: rsparse::data::Numeric<T>>(a: &Vec<Vec<T>>, b: &Vec<Vec<T>>, tol: T) {
7979
for i in 0..a.len() {
8080
for j in 0..a[0].len() {
81-
let diff = f64::abs(a[i][j] - b[i][j]);
81+
let diff = T::abs(a[i][j] - b[i][j]);
8282
if diff > tol {
8383
panic!(
8484
"The 2D Vec are not equal: {:?} != {:?}. -- Check failed by: {}",

0 commit comments

Comments
 (0)