Skip to content

Commit

Permalink
Test size < alignment cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
henningandersen committed Apr 26, 2024
1 parent 32c3795 commit 128e73f
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void testToPageAlignedSize() {
public void testRoundUpToAlignment() {
assertThat(BlobCacheUtils.roundUpToAlignedSize(8, 4), equalTo(8L));
assertThat(BlobCacheUtils.roundUpToAlignedSize(9, 4), equalTo(12L));
assertThat(BlobCacheUtils.roundUpToAlignedSize(between(1, 4), 4), equalTo(4L));
long alignment = randomLongBetween(1, Long.MAX_VALUE / 2);
assertThat(BlobCacheUtils.roundUpToAlignedSize(0, alignment), equalTo(0L));
long value = randomLongBetween(0, Long.MAX_VALUE - alignment);
Expand All @@ -43,6 +44,7 @@ public void testRoundUpToAlignment() {
public void testRoundDownToAlignment() {
assertThat(BlobCacheUtils.roundDownToAlignedSize(8, 4), equalTo(8L));
assertThat(BlobCacheUtils.roundDownToAlignedSize(9, 4), equalTo(8L));
assertThat(BlobCacheUtils.roundDownToAlignedSize(between(0, 3), 4), equalTo(0L));
long alignment = randomLongBetween(1, Long.MAX_VALUE / 2);
long value = randomLongBetween(0, Long.MAX_VALUE);
assertThat(BlobCacheUtils.roundDownToAlignedSize(value, alignment), equalTo(roundDownUsingRemainder(value, alignment)));
Expand Down

0 comments on commit 128e73f

Please sign in to comment.