use of java.util.function.LongSupplier in project lucene-solr by apache.
the class BaseNormsFormatTestCase method testSparseAllZeros.
public void testSparseAllZeros() throws Exception {
assumeTrue("Requires sparse norms support", codecSupportsSparsity());
int iterations = atLeast(1);
for (int i = 0; i < iterations; i++) {
doTestNormsVersusDocValues(random().nextDouble(), new LongSupplier() {
@Override
public long getAsLong() {
return 0;
}
});
}
}
use of java.util.function.LongSupplier in project lucene-solr by apache.
the class BaseNormsFormatTestCase method testNCommon.
public void testNCommon() throws Exception {
final Random r = random();
final int N = TestUtil.nextInt(r, 2, 15);
final long[] commonValues = new long[N];
for (int j = 0; j < N; ++j) {
commonValues[j] = TestUtil.nextLong(r, Byte.MIN_VALUE, Byte.MAX_VALUE);
}
final int numOtherValues = TestUtil.nextInt(r, 2, 256 - N);
final long[] otherValues = new long[numOtherValues];
for (int j = 0; j < numOtherValues; ++j) {
otherValues[j] = TestUtil.nextLong(r, Byte.MIN_VALUE, Byte.MAX_VALUE);
}
doTestNormsVersusDocValues(1, new LongSupplier() {
@Override
public long getAsLong() {
return r.nextInt(100) == 0 ? otherValues[r.nextInt(numOtherValues - 1)] : commonValues[r.nextInt(N - 1)];
}
});
}
use of java.util.function.LongSupplier in project lucene-solr by apache.
the class BaseNormsFormatTestCase method testByteRange.
public void testByteRange() throws Exception {
int iterations = atLeast(1);
final Random r = random();
for (int i = 0; i < iterations; i++) {
doTestNormsVersusDocValues(1, new LongSupplier() {
@Override
public long getAsLong() {
return TestUtil.nextLong(r, Byte.MIN_VALUE, Byte.MAX_VALUE);
}
});
}
}
use of java.util.function.LongSupplier in project lucene-solr by apache.
the class BaseNormsFormatTestCase method testFewValues.
public void testFewValues() throws Exception {
int iterations = atLeast(1);
final Random r = random();
for (int i = 0; i < iterations; i++) {
doTestNormsVersusDocValues(1, new LongSupplier() {
@Override
public long getAsLong() {
return r.nextBoolean() ? 20 : 3;
}
});
}
}
use of java.util.function.LongSupplier in project lucene-solr by apache.
the class BaseNormsFormatTestCase method testSparseShortRange.
public void testSparseShortRange() throws Exception {
assumeTrue("Requires sparse norms support", codecSupportsSparsity());
int iterations = atLeast(1);
final Random r = random();
for (int i = 0; i < iterations; i++) {
doTestNormsVersusDocValues(random().nextDouble(), new LongSupplier() {
@Override
public long getAsLong() {
return TestUtil.nextLong(r, Short.MIN_VALUE, Short.MAX_VALUE);
}
});
}
}
Aggregations