mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
mysql: use double literals in test
This commit is contained in:
parent
493e520c4e
commit
9be1512833
3 changed files with 7 additions and 6 deletions
|
@ -57,6 +57,7 @@ type_id_consts! {
|
|||
// Numeric: FLOAT, DOUBLE
|
||||
pub const FLOAT: TypeId = TypeId(4);
|
||||
pub const DOUBLE: TypeId = TypeId(5);
|
||||
// pub const NEWDECIMAL: TypeId = TypeId(246);
|
||||
|
||||
// Date/Time: DATE, TIME, DATETIME, TIMESTAMP
|
||||
pub const DATE: TypeId = TypeId(10);
|
||||
|
|
|
@ -75,21 +75,21 @@ macro_rules! test_prepared_type {
|
|||
.await?;
|
||||
|
||||
assert!(rec.0,
|
||||
"DB value mismatch; given value: {:?}\n\
|
||||
"[1] DB value mismatch; given value: {:?}\n\
|
||||
as received: {:?}\n\
|
||||
as returned: {:?}\n\
|
||||
round-trip: {:?}",
|
||||
$value, rec.1, rec.2, rec.3);
|
||||
|
||||
assert_eq!($value, rec.2,
|
||||
"DB value mismatch; given value: {:?}\n\
|
||||
"[2] DB value mismatch; given value: {:?}\n\
|
||||
as received: {:?}\n\
|
||||
as returned: {:?}\n\
|
||||
round-trip: {:?}",
|
||||
$value, rec.1, rec.2, rec.3);
|
||||
|
||||
assert_eq!($value, rec.3,
|
||||
"DB value mismatch; given value: {:?}\n\
|
||||
"[3] DB value mismatch; given value: {:?}\n\
|
||||
as received: {:?}\n\
|
||||
as returned: {:?}\n\
|
||||
round-trip: {:?}",
|
||||
|
@ -105,7 +105,7 @@ macro_rules! test_prepared_type {
|
|||
#[macro_export]
|
||||
macro_rules! MySql_query_for_test_prepared_type {
|
||||
() => {
|
||||
"SELECT {0} <=> ?, cast(? as text) as _1, {0} as _2, ? as _3"
|
||||
"SELECT {0} <=> ?, '<UNKNOWN>' as _1, ? as _2, ? as _3"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ test_type!(i32(MySql, i32, "2141512" == 2141512_i32));
|
|||
test_type!(u64(MySql, u64, "2141512" == 2141512_u64));
|
||||
test_type!(i64(MySql, i64, "2141512" == 2141512_i64));
|
||||
|
||||
test_type!(double(MySql, f64, "3.14159265" == 3.14159265f64));
|
||||
test_type!(double(MySql, f64, "3.14159265E0" == 3.14159265f64));
|
||||
|
||||
// NOTE: This behavior can be very surprising. MySQL implicitly widens FLOAT bind parameters
|
||||
// to DOUBLE. This results in the weirdness you see below. MySQL generally recommends to stay
|
||||
|
@ -29,7 +29,7 @@ test_type!(double(MySql, f64, "3.14159265" == 3.14159265f64));
|
|||
test_type!(float(
|
||||
MySql,
|
||||
f32,
|
||||
"3.1410000324249268" == 3.141f32 as f64 as f32
|
||||
"3.1410000324249268e0" == 3.141f32 as f64 as f32
|
||||
));
|
||||
|
||||
test_type!(string(
|
||||
|
|
Loading…
Reference in a new issue