37 import java.util.Collections;
38 import java.util.concurrent.TimeUnit;
39
40 import static org.junit.Assert.assertEquals;
41
42 /**
43 * Tests for AggregateResult
44 */
45 public class TestAggregateResult {
46
47 private static IterationResult result;
48 private static final double[] values = {10.0, 20.0, 30.0, 40.0, 50.0};
49
50 @BeforeClass
51 public static void setupClass() {
52 result = new IterationResult(
53 new BenchmarkParams("blah", "blah", false, 1, new int[]{1}, 1, 1,
54 new IterationParams(IterationType.WARMUP, 1, TimeValue.seconds(1), 1),
55 new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.seconds(1), 1),
56 Mode.Throughput, null, TimeUnit.SECONDS, 1,
57 Utils.getCurrentJvm(), Collections.<String>emptyList()),
58 new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.days(1), 1)
59 );
60 for (double d : values) {
61 result.addResult(new ThroughputResult(ResultRole.PRIMARY, "test1", (long) d, 10 * 1000 * 1000, TimeUnit.MILLISECONDS));
62 }
63 }
64
65 @Test
66 public void testScore() throws Exception {
67 assertEquals(15.0, result.getPrimaryResult().getScore(), 0.00001);
68 }
69
70 @Test
71 public void testScoreUnit() throws Exception {
72 assertEquals((new ThroughputResult(ResultRole.PRIMARY, "test1", 1, 1, TimeUnit.MILLISECONDS)).getScoreUnit(), result.getScoreUnit());
73 }
74
75 }
|
37 import java.util.Collections;
38 import java.util.concurrent.TimeUnit;
39
40 import static org.junit.Assert.assertEquals;
41
42 /**
43 * Tests for AggregateResult
44 */
45 public class TestAggregateResult {
46
47 private static IterationResult result;
48 private static final double[] values = {10.0, 20.0, 30.0, 40.0, 50.0};
49
50 @BeforeClass
51 public static void setupClass() {
52 result = new IterationResult(
53 new BenchmarkParams("blah", "blah", false, 1, new int[]{1}, 1, 1,
54 new IterationParams(IterationType.WARMUP, 1, TimeValue.seconds(1), 1),
55 new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.seconds(1), 1),
56 Mode.Throughput, null, TimeUnit.SECONDS, 1,
57 Utils.getCurrentJvm(), Collections.<String>emptyList(),
58 TimeValue.days(1)),
59 new IterationParams(IterationType.MEASUREMENT, 1, TimeValue.days(1), 1)
60 );
61 for (double d : values) {
62 result.addResult(new ThroughputResult(ResultRole.PRIMARY, "test1", (long) d, 10 * 1000 * 1000, TimeUnit.MILLISECONDS));
63 }
64 }
65
66 @Test
67 public void testScore() throws Exception {
68 assertEquals(15.0, result.getPrimaryResult().getScore(), 0.00001);
69 }
70
71 @Test
72 public void testScoreUnit() throws Exception {
73 assertEquals((new ThroughputResult(ResultRole.PRIMARY, "test1", 1, 1, TimeUnit.MILLISECONDS)).getScoreUnit(), result.getScoreUnit());
74 }
75
76 }
|