Skip to content

Commit 1ca2539

Browse files
authored
fix direction tests by removing rounding and specifying f64 literals
1 parent 9de586b commit 1ca2539

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tests/test_simple.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@ fn effect_builder_creates_rumble_with_direction() {
222222
match effect {
223223
Effect::Rumble(r) => {
224224
assert_eq!(r.duration, 2000);
225-
assert_eq!(r.direction, (90.0 / 360.0 * 65535.0).round() as u16);
225+
assert_eq!(
226+
r.direction,
227+
((90.0f64 / 360.0f64) * 65535.0f64) as u16
228+
);
226229
}
227230
_ => panic!("Expected Rumble effect from builder"),
228231
}
@@ -236,7 +239,10 @@ fn effect_builder_creates_periodic_effect() {
236239

237240
match effect {
238241
Effect::Periodic(p) => {
239-
assert_eq!(p.direction, ((180.0 / 360.0) * 65535.0).round() as u16);
242+
assert_eq!(
243+
p.direction,
244+
((180.0f64 / 360.0f64) * 65535.0f64) as u16
245+
);
240246
assert!(matches!(p.waveform, PeriodicWaveform::Sine));
241247
}
242248
_ => panic!("Expected Periodic effect from builder"),

0 commit comments

Comments
 (0)