// Path: src/main/java/tests/maptests/IMapTest.java
// public interface IMapTest {
//     public void setup( final int[] keys, final float fillFactor, final int oneFailureOutOf );
// 
//     public int test();
// }
// 
// Path: src/main/java/tests/maptests/ITestSet.java
// public interface ITestSet {
//     public IMapTest getTest();
//     public IMapTest putTest();
//     public IMapTest removeTest();
// }


import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import tests.maptests.IMapTest;
import tests.maptests.ITestSet;
import tests.maptests.article_examples.*;
import tests.maptests.identity_object.*;
import tests.maptests.object.*;
import tests.maptests.object_prim.*;
import tests.maptests.prim_object.*;
import tests.maptests.primitive.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
                        .param("m_className", testClass.getCanonicalName())
                        .param("m_testType", testSetName)
                        //.verbosity(VerboseMode.SILENT)
                        .shouldFailOnError(true)
                        .build();

                Collection<RunResult> res = new Runner(opt).run();
                for ( RunResult rr : res )
                {
                    System.out.println( testClass.getCanonicalName() + " (" + mapSize + ") = " + rr.getAggregatedResult().getPrimaryResult().getScore() );
                    Map<Integer, String> forClass = results.computeIfAbsent(testClass.getCanonicalName(), k -> new HashMap<>(4));
                    forClass.put(mapSize, Integer.toString((int) rr.getAggregatedResult().getPrimaryResult().getScore()) );
                }
                if ( res.isEmpty() ) {
                    Map<Integer, String> forClass = results.computeIfAbsent(testClass.getCanonicalName(), k -> new HashMap<>(4));
                    forClass.put(mapSize, "-1");
                }
            }
        }
        final String res = formatResults(results, MAP_SIZES, tests);
        System.out.println( "Results for test type = " + testSetName + ":\n" + res);

        return res;
    }

    private static void testBillion( final List<Class<?>> tests ) throws IllegalAccessException, InstantiationException {
        final int mapSize = 1000 * 1000 * 1000;
        for ( final Class<?> klass : tests )
        {
            System.gc();
// Path: src/main/java/tests/maptests/IMapTest.java
// public interface IMapTest {
//     public void setup( final int[] keys, final float fillFactor, final int oneFailureOutOf );
// 
//     public int test();
// }
// 
// Path: src/main/java/tests/maptests/ITestSet.java
// public interface ITestSet {
//     public IMapTest getTest();
//     public IMapTest putTest();
//     public IMapTest removeTest();
// }


// Path: src/main/java/tests/MapTestRunner.java
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.results.RunResult;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import tests.maptests.IMapTest;
import tests.maptests.ITestSet;
import tests.maptests.article_examples.*;
import tests.maptests.identity_object.*;
import tests.maptests.object.*;
import tests.maptests.object_prim.*;
import tests.maptests.prim_object.*;
import tests.maptests.primitive.*;
import java.util.*;
import java.util.concurrent.TimeUnit;

                        .param("m_className", testClass.getCanonicalName())
                        .param("m_testType", testSetName)
                        //.verbosity(VerboseMode.SILENT)
                        .shouldFailOnError(true)
                        .build();

                Collection<RunResult> res = new Runner(opt).run();
                for ( RunResult rr : res )
                {
                    System.out.println( testClass.getCanonicalName() + " (" + mapSize + ") = " + rr.getAggregatedResult().getPrimaryResult().getScore() );
                    Map<Integer, String> forClass = results.computeIfAbsent(testClass.getCanonicalName(), k -> new HashMap<>(4));
                    forClass.put(mapSize, Integer.toString((int) rr.getAggregatedResult().getPrimaryResult().getScore()) );
                }
                if ( res.isEmpty() ) {
                    Map<Integer, String> forClass = results.computeIfAbsent(testClass.getCanonicalName(), k -> new HashMap<>(4));
                    forClass.put(mapSize, "-1");
                }
            }
        }
        final String res = formatResults(results, MAP_SIZES, tests);
        System.out.println( "Results for test type = " + testSetName + ":\n" + res);

        return res;
    }

    private static void testBillion( final List<Class<?>> tests ) throws IllegalAccessException, InstantiationException {
        final int mapSize = 1000 * 1000 * 1000;
        for ( final Class<?> klass : tests )
        {
            System.gc();
            final IMapTest obj = (IMapTest) klass.newInstance();