Add value size checks tests

This commit is contained in:
Tobie Morgan Hitchcock 2022-05-06 23:33:19 +01:00
parent fc2c48647c
commit 79e9269f14

View file

@ -1333,6 +1333,28 @@ mod tests {
assert_eq!(String::from("something"), Value::from("something").as_string());
}
#[test]
fn check_size() {
assert_eq!(88, std::mem::size_of::<Value>());
assert_eq!(48, std::mem::size_of::<crate::sql::number::Number>());
assert_eq!(24, std::mem::size_of::<crate::sql::strand::Strand>());
assert_eq!(16, std::mem::size_of::<crate::sql::duration::Duration>());
assert_eq!(12, std::mem::size_of::<crate::sql::datetime::Datetime>());
assert_eq!(24, std::mem::size_of::<crate::sql::array::Array>());
assert_eq!(24, std::mem::size_of::<crate::sql::object::Object>());
assert_eq!(56, std::mem::size_of::<crate::sql::geometry::Geometry>());
assert_eq!(24, std::mem::size_of::<crate::sql::param::Param>());
assert_eq!(24, std::mem::size_of::<crate::sql::idiom::Idiom>());
assert_eq!(24, std::mem::size_of::<crate::sql::table::Table>());
assert_eq!(80, std::mem::size_of::<crate::sql::thing::Thing>());
assert_eq!(48, std::mem::size_of::<crate::sql::model::Model>());
assert_eq!(40, std::mem::size_of::<crate::sql::regex::Regex>());
assert_eq!(8, std::mem::size_of::<Box<crate::sql::function::Function>>());
assert_eq!(8, std::mem::size_of::<Box<crate::sql::subquery::Subquery>>());
assert_eq!(8, std::mem::size_of::<Box<crate::sql::expression::Expression>>());
assert_eq!(96, std::mem::size_of::<Result<Value, Error>>());
}
#[test]
fn serialize_deserialize() {
let val = Value::parse(