From ce913ec313665e7cc904630ea7213d6cac15f5e1 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Wed, 25 Sep 2024 11:54:15 -0700 Subject: [PATCH] tests --- components/plurals/src/provider.rs | 4 ++-- components/plurals/src/rules/runtime/ast.rs | 2 +- provider/blob/benches/auxkey_bench.rs | 2 +- utils/zerotrie/tests/asciitrie_test.rs | 2 +- utils/zerotrie/tests/builder_test.rs | 24 ++++++++++----------- utils/zerotrie/tests/locale_aux_test.rs | 8 +++---- utils/zerovec/src/lib.rs | 4 ++-- utils/zerovec/src/map/borrowed.rs | 4 ++-- utils/zerovec/src/map2d/borrowed.rs | 6 +++--- utils/zerovec/src/map2d/map.rs | 6 +++--- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/components/plurals/src/provider.rs b/components/plurals/src/provider.rs index 985ef5924c1..25fb79e1b37 100644 --- a/components/plurals/src/provider.rs +++ b/components/plurals/src/provider.rs @@ -1073,10 +1073,10 @@ fn test_serde_nonsingleton_roundtrip() { assert_eq!( postcard_bytes, &[ - 16, // Postcard header + 14, // Postcard header 0x80, // Discriminant 3, b'a', b'b', b'c', // String of length 3 - 1, 0, 0, 0, 0, 0, // VarZeroVec of length 1 + 1, 0, 0, 0, // VarZeroVec of length 1 0x10, b'd', b'e', b'f', b'g' // Plural category 1 and string "defg" ] ); diff --git a/components/plurals/src/rules/runtime/ast.rs b/components/plurals/src/rules/runtime/ast.rs index 39c34343399..25c44d0dcc6 100644 --- a/components/plurals/src/rules/runtime/ast.rs +++ b/components/plurals/src/rules/runtime/ast.rs @@ -573,7 +573,7 @@ mod test { let vzv = VarZeroVec::<_>::from(relations.as_slice()); assert_eq!( vzv.as_bytes(), - &[1, 0, 0, 0, 0, 0, 192, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0] + &[1, 0, 0, 0, 192, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0] ); } } diff --git a/provider/blob/benches/auxkey_bench.rs b/provider/blob/benches/auxkey_bench.rs index 902128037b9..4364ca9ea7f 100644 --- a/provider/blob/benches/auxkey_bench.rs +++ b/provider/blob/benches/auxkey_bench.rs @@ -293,7 +293,7 @@ fn make_blob_v2() -> Vec { put_payloads::(&mut exporter); exporter.close().unwrap(); drop(exporter); - assert_eq!(blob.len(), 32982); + assert_eq!(blob.len(), 32980); assert!(blob.len() > 100); blob } diff --git a/utils/zerotrie/tests/asciitrie_test.rs b/utils/zerotrie/tests/asciitrie_test.rs index d4db83ac0e2..ae9dcbcf9e3 100644 --- a/utils/zerotrie/tests/asciitrie_test.rs +++ b/utils/zerotrie/tests/asciitrie_test.rs @@ -69,5 +69,5 @@ fn test_basic() { .expect("Failed to finalize serializer output"); assert_eq!(26, bytes_ascii.len()); - assert_eq!(61, zeromap_bytes.len()); + assert_eq!(59, zeromap_bytes.len()); } diff --git a/utils/zerotrie/tests/builder_test.rs b/utils/zerotrie/tests/builder_test.rs index 1c54927a9c5..d92ad8520dc 100644 --- a/utils/zerotrie/tests/builder_test.rs +++ b/utils/zerotrie/tests/builder_test.rs @@ -650,19 +650,19 @@ fn test_everything() { let zhm: zerovec::ZeroMap<[u8], usize> = litemap.iter().map(|(a, b)| (*a, b)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 75); + assert_eq!(zhm_buf.len(), 73); let zhm: zerovec::ZeroMap<[u8], u8> = litemap.iter().map(|(a, b)| (*a, *b as u8)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 65); + assert_eq!(zhm_buf.len(), 63); let zhm: zerovec::ZeroHashMap<[u8], usize> = litemap.iter().map(|(a, b)| (*a, b)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 148); + assert_eq!(zhm_buf.len(), 146); let zhm: zerovec::ZeroHashMap<[u8], u8> = litemap.iter().map(|(a, b)| (*a, *b as u8)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 138); + assert_eq!(zhm_buf.len(), 136); } macro_rules! utf8_byte { @@ -806,19 +806,19 @@ fn test_short_subtags_10pct() { let zhm: zerovec::ZeroMap<[u8], usize> = litemap.iter().map(|(a, b)| (*a, b)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 1331); + assert_eq!(zhm_buf.len(), 1329); let zhm: zerovec::ZeroMap<[u8], u8> = litemap.iter().map(|(a, b)| (*a, *b as u8)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 1330); + assert_eq!(zhm_buf.len(), 1328); let zhm: zerovec::ZeroHashMap<[u8], usize> = litemap.iter().map(|(a, b)| (*a, b)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 2837); + assert_eq!(zhm_buf.len(), 2835); let zhm: zerovec::ZeroHashMap<[u8], u8> = litemap.iter().map(|(a, b)| (*a, *b as u8)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 2836); + assert_eq!(zhm_buf.len(), 2834); } #[test] @@ -836,17 +836,17 @@ fn test_short_subtags() { let zm: zerovec::ZeroMap<[u8], usize> = litemap.iter().map(|(a, b)| (*a, b)).collect(); let zhm_buf = postcard::to_allocvec(&zm).unwrap(); - assert_eq!(zhm_buf.len(), 15182); + assert_eq!(zhm_buf.len(), 15180); let zm: zerovec::ZeroMap<[u8], u8> = litemap.iter().map(|(a, b)| (*a, *b as u8)).collect(); let zhm_buf = postcard::to_allocvec(&zm).unwrap(); - assert_eq!(zhm_buf.len(), 13304); + assert_eq!(zhm_buf.len(), 13302); let zhm: zerovec::ZeroHashMap<[u8], usize> = litemap.iter().map(|(a, b)| (*a, b)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 30200); + assert_eq!(zhm_buf.len(), 30198); let zhm: zerovec::ZeroHashMap<[u8], u8> = litemap.iter().map(|(a, b)| (*a, *b as u8)).collect(); let zhm_buf = postcard::to_allocvec(&zhm).unwrap(); - assert_eq!(zhm_buf.len(), 28322); + assert_eq!(zhm_buf.len(), 28320); } diff --git a/utils/zerotrie/tests/locale_aux_test.rs b/utils/zerotrie/tests/locale_aux_test.rs index f478777ba38..eea27af7842 100644 --- a/utils/zerotrie/tests/locale_aux_test.rs +++ b/utils/zerotrie/tests/locale_aux_test.rs @@ -25,12 +25,12 @@ fn test_combined() { let vzv: VarZeroVec = STRINGS.into(); // Lookup table size: - assert_eq!(vzv.as_bytes().len(), 10223); + assert_eq!(vzv.as_bytes().len(), 10221); // Size including pointer array: assert_eq!( vzv.as_bytes().len() + STRINGS.len() * core::mem::size_of::(), - 18639 + 18637 ); let trie = ZeroTrieSimpleAscii::try_from(&litemap).unwrap(); @@ -133,7 +133,7 @@ fn test_aux_split() { assert_eq!(total_simpleascii_len, 5098); assert_eq!(total_perfecthash_len, 5302); - assert_eq!(total_vzv_len, 5510); + assert_eq!(total_vzv_len, 5498); let total_unique_locale_str_len = unique_locales.iter().map(|v| v.len()).sum::(); assert_eq!(total_unique_locale_str_len, 945); @@ -149,7 +149,7 @@ fn test_aux_split() { ); assert_eq!( total_vzv_len + STRINGS.len() * core::mem::size_of::(), - 13926 + 13914 ); // 2x for the lookup arrays and value arrays assert_eq!( diff --git a/utils/zerovec/src/lib.rs b/utils/zerovec/src/lib.rs index 214039a1faf..0ea8ae99c86 100644 --- a/utils/zerovec/src/lib.rs +++ b/utils/zerovec/src/lib.rs @@ -75,7 +75,7 @@ //! }; //! let bincode_bytes = //! bincode::serialize(&data).expect("Serialization should be successful"); -//! assert_eq!(bincode_bytes.len(), 67); +//! assert_eq!(bincode_bytes.len(), 65); //! //! let deserialized: DataStruct = bincode::deserialize(&bincode_bytes) //! .expect("Deserialization should be successful"); @@ -149,7 +149,7 @@ //! //! let bincode_bytes = bincode::serialize(&data) //! .expect("Serialization should be successful"); -//! assert_eq!(bincode_bytes.len(), 168); +//! assert_eq!(bincode_bytes.len(), 164); //! //! let deserialized: Data = bincode::deserialize(&bincode_bytes) //! .expect("Deserialization should be successful"); diff --git a/utils/zerovec/src/map/borrowed.rs b/utils/zerovec/src/map/borrowed.rs index 8a9ed8acaea..8cfd0d82c27 100644 --- a/utils/zerovec/src/map/borrowed.rs +++ b/utils/zerovec/src/map/borrowed.rs @@ -23,8 +23,8 @@ use super::vecs::ZeroVecLike; /// use zerovec::maps::ZeroMapBorrowed; /// /// // Example byte buffer representing the map { 1: "one" } -/// let BINCODE_BYTES: &[u8; 29] = &[ -/// 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, +/// let BINCODE_BYTES: &[u8; 27] = &[ +/// 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 1, 0, /// 0, 0, 111, 110, 101, /// ]; /// diff --git a/utils/zerovec/src/map2d/borrowed.rs b/utils/zerovec/src/map2d/borrowed.rs index 02ff9e398ea..7012a90f1bb 100644 --- a/utils/zerovec/src/map2d/borrowed.rs +++ b/utils/zerovec/src/map2d/borrowed.rs @@ -23,10 +23,10 @@ use crate::map2d::ZeroMap2dCursor; /// use zerovec::maps::ZeroMap2dBorrowed; /// /// // Example byte buffer representing the map { 1: {2: "three" } } -/// let BINCODE_BYTES: &[u8; 51] = &[ +/// let BINCODE_BYTES: &[u8; 49] = &[ /// 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, -/// 0, 0, 0, 0, 0, 0, 2, 0, 11, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 116, -/// 104, 114, 101, 101, +/// 0, 0, 0, 0, 0, 0, 2, 0, 9, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 104, +/// 114, 101, 101 /// ]; /// /// // Deserializing to ZeroMap2d requires no heap allocations. diff --git a/utils/zerovec/src/map2d/map.rs b/utils/zerovec/src/map2d/map.rs index 5a9d830548a..0a0a6753b52 100644 --- a/utils/zerovec/src/map2d/map.rs +++ b/utils/zerovec/src/map2d/map.rs @@ -34,10 +34,10 @@ use crate::map::{MutableZeroVecLike, ZeroVecLike}; /// use zerovec::ZeroMap2d; /// /// // Example byte buffer representing the map { 1: {2: "three" } } -/// let BINCODE_BYTES: &[u8; 51] = &[ +/// let BINCODE_BYTES: &[u8; 49] = &[ /// 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 0, -/// 0, 0, 0, 0, 0, 0, 2, 0, 11, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 116, -/// 104, 114, 101, 101, +/// 0, 0, 0, 0, 0, 0, 2, 0, 9, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 116, 104, +/// 114, 101, 101 /// ]; /// /// // Deserializing to ZeroMap requires no heap allocations.