test(rust): make entropy tests portable to 32-bit
Use an explicitly 64-bit literal before narrowing it in the common-byte test, and derive the FSE compression-bound expectation from `size_of::<usize>()`. The tests now exercise the same public contracts on 32-bit and 64-bit targets instead of embedding a 64-bit-only compile-time assumption. Test Plan: - cargo clippy; cargo clippy --benches; cargo clippy --tests - cargo +nightly fmt, then repeat the Clippy checks - cargo test --target i686-unknown-linux-gnu --lib - cargo test --target i686-unknown-linux-gnu --lib --features \ huf-force-decompress-x1 - cargo test --target i686-unknown-linux-gnu --lib --features \ huf-force-decompress-x2 Refs: rust/README.md
This commit is contained in:
+1
-1
@@ -103,7 +103,7 @@ mod tests {
|
||||
if MEM_isLittleEndian() {
|
||||
assert_eq!(ZSTD_NbCommonBytes(0x0000_0000_0001_0000), 2);
|
||||
} else if MEM_64bits() {
|
||||
assert_eq!(ZSTD_NbCommonBytes(0x0001_0000_0000_0000), 2);
|
||||
assert_eq!(ZSTD_NbCommonBytes(0x0001_0000_0000_0000u64 as usize), 2);
|
||||
} else {
|
||||
assert_eq!(ZSTD_NbCommonBytes(0x0001_0000), 2);
|
||||
}
|
||||
|
||||
@@ -992,7 +992,11 @@ mod tests {
|
||||
assert_eq!(result, 5);
|
||||
assert_eq!(normalized, [3, 1, 4, 1, 5, 10, 2, 6]);
|
||||
assert_eq!(FSE_NCountWriteBound(4, 5), 6);
|
||||
assert_eq!(FSE_compressBound(33), 557);
|
||||
let input_size = 33usize;
|
||||
assert_eq!(
|
||||
FSE_compressBound(input_size),
|
||||
FSE_NCOUNTBOUND + input_size + (input_size >> 7) + 4 + size_of::<usize>()
|
||||
);
|
||||
assert_eq!(FSE_optimalTableLog(12, 33, 4), 5);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user