add integration tests mysql-types.rs/decimal

This commit is contained in:
xiaopengli89 2020-04-08 15:29:15 +08:00 committed by Ryan Leckey
parent 229635771a
commit d50405743b

View file

@ -123,3 +123,15 @@ mod time_tests {
.assume_utc()
));
}
#[cfg(feature = "bigdecimal")]
test_type!(decimal(
MySql,
sqlx::types::BigDecimal,
"CAST(1 AS DECIMAL(1, 0))" == "1".parse::<sqlx::types::BigDecimal>().unwrap(),
"CAST(10000 AS DECIMAL(5, 0))" == "10000".parse::<sqlx::types::BigDecimal>().unwrap(),
"CAST(0.1 AS DECIMAL(2, 1))" == "0.1".parse::<sqlx::types::BigDecimal>().unwrap(),
"CAST(0.01234 AS DECIMAL(6, 5))" == "0.01234".parse::<sqlx::types::BigDecimal>().unwrap(),
"CAST(12.34 AS DECIMAL(4, 2))" == "12.34".parse::<sqlx::types::BigDecimal>().unwrap(),
"CAST(12345.6789 AS DECIMAL(9, 4))" == "12345.6789".parse::<sqlx::types::BigDecimal>().unwrap(),
));