File tree 2 files changed +14
-11
lines changed
2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -133,22 +133,24 @@ fn assert_data_eq(a: &Data, b: &Data) {
133
133
for x in 0 ..a. n . 0 {
134
134
let idx = ( x + y * a. n . 1 + z * a. n . 1 * a. n . 0 ) as usize ;
135
135
136
- assert_eq ! (
137
- a. vsq[ idx] , b. vsq[ idx] ,
136
+ const EPSILON : f32 = 1E-4 ;
137
+
138
+ assert ! (
139
+ ( a. vsq[ idx] - b. vsq[ idx] ) . abs( ) < EPSILON ,
138
140
"vsq diff at idx = {} ({}, {}, {})" ,
139
- idx, x, y, z
141
+ idx, x, y, z,
140
142
) ;
141
143
142
- assert_eq ! (
143
- a. a. 0 [ idx] , b. a. 0 [ idx] ,
144
+ assert ! (
145
+ ( a. a. 0 [ idx] - b. a. 0 [ idx] ) . abs ( ) < EPSILON ,
144
146
"a.0 diff at idx = {} ({}, {}, {})" ,
145
- idx, x, y, z
147
+ idx, x, y, z,
146
148
) ;
147
149
148
- assert_eq ! (
149
- a. a. 1 [ idx] , b. a. 1 [ idx] ,
150
+ assert ! (
151
+ ( a. a. 1 [ idx] - b. a. 1 [ idx] ) . abs ( ) < EPSILON ,
150
152
"a.1 diff at idx = {} ({}, {}, {})" ,
151
- idx, x, y, z
153
+ idx, x, y, z,
152
154
) ;
153
155
}
154
156
}
Original file line number Diff line number Diff line change @@ -63,7 +63,8 @@ pub fn scalar(
63
63
#[ cfg( all( test, feature = "ispc" ) ) ]
64
64
mod tests {
65
65
use super :: scalar;
66
- use { ispc_loops:: serial, Data } ;
66
+ use ispc_loops:: serial;
67
+ use { assert_data_eq, Data } ;
67
68
68
69
#[ test]
69
70
@@ -74,6 +75,6 @@ mod tests {
74
75
let mut data_ispc = Data :: default ( ) ;
75
76
data_ispc. exec ( serial) ;
76
77
77
- assert_eq ! ( data_scalar, data_ispc) ;
78
+ assert_data_eq ( & data_scalar, & data_ispc) ;
78
79
}
79
80
}
You can’t perform that action at this time.
0 commit comments