Skip to content

Commit 49b9204

Browse files
committed
add overflow tests
1 parent 9e377c4 commit 49b9204

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/addr.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,4 +824,16 @@ mod tests {
824824
VirtAddr::new(0)
825825
);
826826
}
827+
828+
#[test]
829+
#[should_panic]
830+
fn test_virt_addr_align_up_overflow() {
831+
VirtAddr::new(0xffff_ffff_ffff_ffff).align_up(2u64);
832+
}
833+
834+
#[test]
835+
#[should_panic]
836+
fn test_phys_addr_align_up_overflow() {
837+
PhysAddr::new(0x000f_ffff_ffff_ffff).align_up(2u64);
838+
}
827839
}

0 commit comments

Comments
 (0)