/*
 *      Copyright (C) 2015  higherfrequencytrading.com
 *
 *      This program is free software: you can redistribute it and/or modify
 *      it under the terms of the GNU Lesser General Public License as published by
 *      the Free Software Foundation, either version 3 of the License.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU Lesser General Public License for more details.
 *
 *      You should have received a copy of the GNU Lesser General Public License
 *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.openhft.chronicle.map;

import net.openhft.chronicle.core.OS;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;

public class MaximumChronicleMapSizeTest {

    @Before
    public void assumeLinux() {
        Assume.assumeTrue(OS.isLinux());
    }

    @Test
    public void maximumChronicleMapSizeTest() {
        ChronicleMap<Long, Long> map = ChronicleMap
                .of(Long.class, Long.class)
                .entries(1000_000_000_000L)
                .create();
        map.put(1L, 1L);
    }
}

@@ -803,16 +803,58 @@
 ore.OS;%0A
+import net.openhft.chronicle.set.Builder;%0A
 import o
@@ -919,16 +919,66 @@
 .Test;%0A%0A
+import java.io.File;%0Aimport java.io.IOException;%0A%0A
 public c
@@ -1134,24 +1134,32 @@
 void maximum
+InMemory
 ChronicleMap
@@ -1179,16 +1179,90 @@
         
+long maxSize = 1 %3C%3C 30;%0A        for (; ; maxSize *= 2) %7B%0A            try (
 Chronicl
@@ -1313,16 +1313,20 @@
         
+ 
+   
 .of(Long
@@ -1361,16 +1361,20 @@
         
+    
 .entries
@@ -1378,62 +1378,705 @@
 ies(
-1000_000_000_000L)%0A                .create();%0A
+maxSize)%0A                    .create()) %7B%0A                map.put(1L, 1L);%0A            %7D catch (Throwable e) %7B%0A                e.printStackTrace();%0A                break;%0A            %7D%0A        %7D%0A        System.out.println(%22Max in-memory chronicle map size is %22 + (maxSize / 2));%0A    %7D%0A%0A    @Test%0A    public void maximumPersistedChronicleMapSizeTest() throws IOException %7B%0A        File file = Builder.getPersistenceFile();%0A        long maxSize = 1 %3C%3C 30;%0A        for (; ; maxSize *= 2) %7B%0A            try (ChronicleMap%3CLong, Long%3E map = ChronicleMap%0A                    .of(Long.class, Long.class)%0A                    .entries(maxSize)%0A                    .createPersistedTo(file)) %7B%0A       
         
 map.
@@ -2063,32 +2063,33 @@
 %0A               
+ 
 map.put(1L, 1L);
@@ -2085,20 +2085,279 @@
 ut(1L, 1L);%0A
+            %7D catch (Throwable e) %7B%0A                e.printStackTrace();%0A                break;%0A            %7D finally %7B%0A                file.delete();%0A            %7D%0A        %7D%0A        System.out.println(%22Max persisted chronicle map size is %22 + (maxSize / 2));%0A
     %7D%0A%7D%0A

Update MaximumChronicleMapSizeTest