Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Sep 25, 2024
1 parent e337aed commit 7dd76b6
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions components/plurals/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
);
Expand Down
2 changes: 1 addition & 1 deletion components/plurals/src/rules/runtime/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
);
}
}
2 changes: 1 addition & 1 deletion provider/blob/benches/auxkey_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ fn make_blob_v2() -> Vec<u8> {
put_payloads::<MarkerD>(&mut exporter);
exporter.close().unwrap();
drop(exporter);
assert_eq!(blob.len(), 32982);
assert_eq!(blob.len(), 32980);
assert!(blob.len() > 100);
blob
}
Expand Down
2 changes: 1 addition & 1 deletion utils/zerotrie/tests/asciitrie_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
24 changes: 12 additions & 12 deletions utils/zerotrie/tests/builder_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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]
Expand All @@ -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);
}
8 changes: 4 additions & 4 deletions utils/zerotrie/tests/locale_aux_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ fn test_combined() {
let vzv: VarZeroVec<str> = 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::<usize>(),
18639
18637
);

let trie = ZeroTrieSimpleAscii::try_from(&litemap).unwrap();
Expand Down Expand Up @@ -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::<usize>();
assert_eq!(total_unique_locale_str_len, 945);
Expand All @@ -149,7 +149,7 @@ fn test_aux_split() {
);
assert_eq!(
total_vzv_len + STRINGS.len() * core::mem::size_of::<usize>(),
13926
13914
);
// 2x for the lookup arrays and value arrays
assert_eq!(
Expand Down

0 comments on commit 7dd76b6

Please sign in to comment.