From 7dd76b6480a4c5ef8a31fd5e8dedceeb1e70406f 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 +++---- 6 files changed, 21 insertions(+), 21 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!(