use of com.hazelcast.jet.accumulator.LongDoubleAccumulator in project hazelcast by hazelcast.
the class AggregateOperationsTest method when_averagingDouble_noInput_then_NaN.
@Test
public void when_averagingDouble_noInput_then_NaN() {
// Given
AggregateOperation1<Double, LongDoubleAccumulator, Double> aggrOp = averagingDouble(Double::doubleValue);
LongDoubleAccumulator acc = aggrOp.createFn().get();
// When
double result = aggrOp.finishFn().apply(acc);
// Then
assertEquals(Double.NaN, result, 0.0);
}
use of com.hazelcast.jet.accumulator.LongDoubleAccumulator in project hazelcast by hazelcast.
the class AggregateOperationsTest method when_averagingDouble_tooManyItems_then_exception.
@Test
public void when_averagingDouble_tooManyItems_then_exception() {
// Given
AggregateOperation1<Double, LongDoubleAccumulator, Double> aggrOp = averagingDouble(Double::doubleValue);
LongDoubleAccumulator acc = new LongDoubleAccumulator(Long.MAX_VALUE, 0.0d);
// Then
exception.expect(ArithmeticException.class);
// When
aggrOp.accumulateFn().accept(acc, 0.0d);
}
use of com.hazelcast.jet.accumulator.LongDoubleAccumulator in project hazelcast-jet by hazelcast.
the class AggregateOperationsTest method when_averagingDoubleOverflow_thenException.
@Test
public void when_averagingDoubleOverflow_thenException() {
// Given
AggregateOperation1<Double, LongDoubleAccumulator, Double> aggrOp = averagingDouble(Double::doubleValue);
LongDoubleAccumulator acc = new LongDoubleAccumulator(Long.MAX_VALUE, 0.0d);
// When and Then
exception.expect(ArithmeticException.class);
aggrOp.accumulateFn().accept(acc, 0.0d);
}
Aggregations