MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / test_usize_too_big

Function test_usize_too_big

src/pack_ints.rs:508–520  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

506
507 #[test]
508 fn test_usize_too_big() {
509 for scale in [1, 1 << 8, 1 << 16, 1 << 32] {
510 let a = COUNTING.map(|v| v as u64 * scale + u32::MAX as u64);
511 let packed = pack_ints(&a);
512 let b = unpack_ints::<usize>(&packed, a.len());
513 if cfg!(target_pointer_width = "64") {
514 let b = b.unwrap();
515 assert_eq!(a, std::array::from_fn(|i| b[i] as u64));
516 } else {
517 assert_eq!(b.unwrap_err(), usize_too_big());
518 }
519 }
520 }
521
522 #[test]
523 fn test_isize_too_big() {

Callers

nothing calls this directly

Calls 2

pack_intsFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected