termwiz: add a test to assert size of cell structs

`cargo test -p termwiz`

(fixup color.rs test to run when serde feature is disabled)
This commit is contained in:
Wez Furlong committed 2020-10-11 12:40:07 -07:00
1 parent dedfc4513b
commit 7e232ae1af
2 files changed
+12

No files matched your search

+11
View File
@@ -380,6 +380,17 @@ pub enum AttributeChange {
mod test {
use super::*;
#[test]
#[cfg(target_pointer_width = "64")]
fn memory_usage() {
assert_eq!(std::mem::size_of::<crate::color::RgbColor>(), 3);
assert_eq!(std::mem::size_of::<ColorAttribute>(), 5);
assert_eq!(std::mem::size_of::<CellAttributes>(), 32);
assert_eq!(std::mem::size_of::<Cell>(), 64);
assert_eq!(std::mem::size_of::<Vec<u8>>(), 24);
assert_eq!(std::mem::size_of::<char>(), 4);
}
#[test]
fn nerf_special() {
for c in " \n\r\t".chars() {
+1
View File
@@ -413,6 +413,7 @@ mod tests {
assert_eq!(grey.blue, 0xf0);
}
#[cfg(feature = "use_serde")]
#[test]
fn roundtrip_rgbcolor() {
let data = varbincode::serialize(&RgbColor::from_named("DarkGreen").unwrap()).unwrap();