Package test.util

Examples of test.util.HashFunctionInteger


    protected SegmentFactory getSegmentFactory() {
        return new krati.core.segment.MemorySegmentFactory();
    }
   
    protected DynamicDataStore getDynamicDataStore(File storeDir, int initLevel, int segFileSizeMB) throws Exception {
        return new DynamicDataStore(storeDir, initLevel, 10000, 5, segFileSizeMB, getSegmentFactory(), 0.75, new HashFunctionInteger());
    }
View Full Code Here


        StatsLog.logger.info(">>> testHashFunction");
       
        int i = 0;
        byte[] intByteArray = new byte[4];
        ByteBuffer intByteBuffer = ByteBuffer.wrap(intByteArray);
        HashFunctionInteger intHash = new HashFunctionInteger();
       
        try {
            i = 0;
            intByteBuffer.clear();
            intByteBuffer.putInt(i);
            assertEquals(i, intHash.hash(intByteArray));
           
            i = 1023;
            intByteBuffer.clear();
            intByteBuffer.putInt(i);
            assertEquals(i, intHash.hash(intByteArray));
           
            i = 65535;
            intByteBuffer.clear();
            intByteBuffer.putInt(i);
            assertEquals(i, intHash.hash(intByteArray));
           
            i = 131072;
            intByteBuffer.clear();
            intByteBuffer.putInt(i);
            assertEquals(i, intHash.hash(intByteArray));
           
            i = 262144;
            intByteBuffer.clear();
            intByteBuffer.putInt(i);
            assertEquals(i, intHash.hash(intByteArray));
        } catch (RuntimeException e) {
            System.err.printf("hash(%d)=%d%n", i, intHash.hash(intByteArray));
            throw e;
        }
    }
View Full Code Here

TOP

Related Classes of test.util.HashFunctionInteger

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.