package org.capnproto;

import org.junit.Assert;
import org.junit.Test;

public class DefaultAllocatorTest {
    @Test
    public void checkNoOverflow() {
      DefaultAllocator allocator = new DefaultAllocator();
      Assert.assertEquals(allocator.allocationStrategy,
                          BuilderArena.AllocationStrategy.GROW_HEURISTICALLY);
      allocator.setNextAllocationSizeBytes(1 << 30);

      Assert.assertEquals(1 << 30,
                          allocator.allocateSegment(1 << 30).capacity());

      Assert.assertEquals(allocator.maxSegmentBytes,
                          allocator.allocateSegment(1 << 30).capacity());

      Assert.assertEquals(allocator.maxSegmentBytes,
                          allocator.allocateSegment(1 << 30).capacity());
    }
}

@@ -132,23 +132,23 @@
 oid 
-checkNoOverflow
+maxSegmentBytes
 () %7B
@@ -342,16 +342,102 @@
 CALLY);%0A
+      allocator.maxSegmentBytes = (1 %3C%3C 25) - 1;%0A%0A      int allocationSize = 1 %3C%3C 24;%0A
       al
@@ -471,23 +471,30 @@
 zeBytes(
-1 %3C%3C 30
+allocationSize
 );%0A%0A    
@@ -515,23 +515,30 @@
 tEquals(
-1 %3C%3C 30
+allocationSize
 ,%0A      
@@ -575,39 +575,46 @@
 allocateSegment(
-1 %3C%3C 30
+allocationSize
 ).capacity());%0A%0A
@@ -710,39 +710,46 @@
 allocateSegment(
-1 %3C%3C 30
+allocationSize
 ).capacity());%0A%0A
@@ -857,15 +857,22 @@
 ent(
-1 %3C%3C 30
+allocationSize
 ).ca

make new unit test less memory intensive