Skip to content

Commit e2f4996

Browse files
cursoragentlovasoa
andcommitted
Test: Improve f64 precision and bool assertions
Co-authored-by: contact <[email protected]>
1 parent a54a568 commit e2f4996

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/mysql/types.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::f64::consts::PI;
12
extern crate time_ as time;
23

34
#[cfg(feature = "decimal")]
@@ -23,7 +24,7 @@ test_type!(i64(MySql, "2141512" == 2141512_i64));
2324

2425
test_type!(f64(
2526
MySql,
26-
"3.14159265e0" == 3.14159265_f64,
27+
"3.141592653589793e0" == PI,
2728
"25.25" == 25.25_f64,
2829
));
2930

@@ -331,7 +332,7 @@ CREATE TEMPORARY TABLE with_bits (
331332
// as bool
332333
let row = conn.fetch_one("SELECT value_1 FROM with_bits").await?;
333334
let v1: bool = row.try_get(0)?;
334-
assert_eq!(v1, true);
335+
assert!(v1);
335336

336337
// switch the bit
337338
sqlx_oldapi::query("UPDATE with_bits SET value_1 = NOT value_1")
@@ -340,7 +341,7 @@ CREATE TEMPORARY TABLE with_bits (
340341

341342
let row = conn.fetch_one("SELECT value_1 FROM with_bits").await?;
342343
let v1: bool = row.try_get(0)?;
343-
assert_eq!(v1, false);
344+
assert!(!v1);
344345

345346
Ok(())
346347
}

0 commit comments

Comments
 (0)