mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
fixup types
This commit is contained in:
parent
1e8d675cc0
commit
e338c94bec
@ -16,6 +16,8 @@
|
||||
|
||||
package io.nosqlbench.adapters.api.scheduling;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
@ -23,6 +25,7 @@ import java.time.Duration;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class TimeoutPredicateTest {
|
||||
private final static Logger logger = LogManager.getLogger(TimeoutPredicateTest.class);
|
||||
|
||||
@Test
|
||||
public void testNeverCompletablePreciate() {
|
||||
@ -90,13 +93,13 @@ public class TimeoutPredicateTest {
|
||||
);
|
||||
|
||||
TimeoutPredicate.Result<Long> result = canMakeIt.test();
|
||||
System.out.println(result);
|
||||
logger.info(result);
|
||||
|
||||
while (result.status() == TimeoutPredicate.Status.pending) {
|
||||
// canMakeIt.blockUntilNextInterval();
|
||||
result = canMakeIt.test();
|
||||
System.out.println(canMakeIt);
|
||||
System.out.println(result);
|
||||
logger.info(canMakeIt);
|
||||
logger.info(result);
|
||||
}
|
||||
|
||||
assertThat(result.status()).isEqualTo(TimeoutPredicate.Status.complete);
|
||||
|
@ -28,7 +28,7 @@ import static io.nosqlbench.virtdata.library.curves4.discrete.int_int.Enumerated
|
||||
|
||||
@ThreadSafeMapper
|
||||
@Categories({Category.distributions})
|
||||
public class EnumeratedInts extends IntToLongDiscreteCurve {
|
||||
public class EnumeratedInts extends LongToIntDiscreteCurve {
|
||||
public EnumeratedInts(String data, String... mods) {
|
||||
super(new EnumeratedIntegerDistribution(parseIntLabels(data), parseDoubleWeights(data)), mods);
|
||||
}
|
||||
|
@ -2,13 +2,13 @@ package io.nosqlbench.virtdata.library.curves4.discrete.int_int;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2022 nosqlbench
|
||||
*
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@ -56,7 +56,26 @@ public class EnumeratedIntsTest {
|
||||
Arrays.fill(counts,0.0d);
|
||||
int samples = 1000;
|
||||
for (int i = 0; i < samples; i++) {
|
||||
long v = ei.applyAsLong(i);
|
||||
long v = ei.applyAsInt(i);
|
||||
assertThat(v).isGreaterThanOrEqualTo(0);
|
||||
assertThat(v).isLessThanOrEqualTo(4);
|
||||
counts[(int) v] += 1.0d;
|
||||
}
|
||||
for (double count : counts) {
|
||||
assertThat(count/samples).isCloseTo((count/(double) samples), Offset.offset(0.01d));
|
||||
}
|
||||
StreamSupport.stream(spliterator(counts,0),false).forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void EnumeratedLongToInt() {
|
||||
io.nosqlbench.virtdata.library.curves4.discrete.long_int.EnumeratedInts ei =
|
||||
new io.nosqlbench.virtdata.library.curves4.discrete.long_int.EnumeratedInts ("0 1 2 3 4");
|
||||
double counts[] = new double[5];
|
||||
Arrays.fill(counts,0.0d);
|
||||
int samples = 1000;
|
||||
for (int i = 0; i < samples; i++) {
|
||||
long v = ei.applyAsInt(i);
|
||||
assertThat(v).isGreaterThanOrEqualTo(0);
|
||||
assertThat(v).isLessThanOrEqualTo(4);
|
||||
counts[(int) v] += 1.0d;
|
||||
|
Loading…
Reference in New Issue
Block a user