Search in sources :

Example 1 with IntHashSet

use of com.questdb.std.IntHashSet in project questdb by bluestreak01.

the class DateFormatCompilerTest method testOperationUniqueness.

@Test
public void testOperationUniqueness() {
    Assert.assertTrue(DateFormatCompiler.opList.size() > 0);
    IntHashSet codeSet = new IntHashSet();
    CharSequenceHashSet nameSet = new CharSequenceHashSet();
    for (int i = 0, n = DateFormatCompiler.opList.size(); i < n; i++) {
        String name = DateFormatCompiler.opList.getQuick(i);
        int code = DateFormatCompiler.opMap.get(name);
        Assert.assertTrue(codeSet.add(code));
        Assert.assertTrue(nameSet.add(name));
    }
}
Also used : CharSequenceHashSet(com.questdb.std.CharSequenceHashSet) IntHashSet(com.questdb.std.IntHashSet) Test(org.junit.Test)

Example 2 with IntHashSet

use of com.questdb.std.IntHashSet in project questdb by bluestreak01.

the class DateFormatCompilerTest method testOperationUniqueness.

@Test
public void testOperationUniqueness() {
    Assert.assertTrue(DateFormatCompiler.opList.size() > 0);
    IntHashSet codeSet = new IntHashSet();
    CharSequenceHashSet nameSet = new CharSequenceHashSet();
    for (int i = 0, n = DateFormatCompiler.opList.size(); i < n; i++) {
        String name = DateFormatCompiler.opList.getQuick(i);
        int code = DateFormatCompiler.opMap.get(name);
        Assert.assertTrue(codeSet.add(code));
        Assert.assertTrue(nameSet.add(name));
    }
}
Also used : CharSequenceHashSet(com.questdb.std.CharSequenceHashSet) IntHashSet(com.questdb.std.IntHashSet) Test(org.junit.Test)

Example 3 with IntHashSet

use of com.questdb.std.IntHashSet in project questdb by bluestreak01.

the class HashTest method testStringHash.

@Test
public void testStringHash() {
    Rnd rnd = new Rnd();
    IntHashSet hashes = new IntHashSet(100000);
    final int LEN = 64;
    long address = Unsafe.malloc(LEN);
    for (int i = 0; i < 100000; i++) {
        rnd.nextChars(address, LEN / 2);
        hashes.add(Hash.hashMem(address, LEN));
    }
    Assert.assertTrue("Hash function distribution dropped", hashes.size() > 99990);
}
Also used : IntHashSet(com.questdb.std.IntHashSet) Rnd(com.questdb.std.Rnd) Test(org.junit.Test)

Aggregations

IntHashSet (com.questdb.std.IntHashSet)3 Test (org.junit.Test)3 CharSequenceHashSet (com.questdb.std.CharSequenceHashSet)2 Rnd (com.questdb.std.Rnd)1