timing: ss statistics use the common statistics
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.timing.core.tests / src / org / eclipse / tracecompass / analysis / timing / core / tests / segmentstore / statistics / SegmentStoreStatisticsTest.java
CommitLineData
e06c9955 1/*******************************************************************************
658401c8 2 * Copyright (c) 2016 Ericsson
e06c9955
MK
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9
658401c8 10package org.eclipse.tracecompass.analysis.timing.core.tests.segmentstore.statistics;
e06c9955 11
fb042960 12import java.util.Collection;
e06c9955 13import java.util.Random;
fb042960 14import java.util.stream.Collectors;
e06c9955
MK
15
16import org.eclipse.jdt.annotation.NonNull;
fb042960 17import org.eclipse.tracecompass.analysis.timing.core.tests.statistics.AbstractStatisticsTest;
660d4ed9 18import org.eclipse.tracecompass.segmentstore.core.BasicSegment;
e06c9955 19import org.eclipse.tracecompass.segmentstore.core.ISegment;
e06c9955
MK
20
21/**
fb042960 22 * Test statistics for segment length
e06c9955
MK
23 *
24 * @author Matthew Khouzam
e06c9955 25 */
fb042960 26public class SegmentStoreStatisticsTest extends AbstractStatisticsTest<@NonNull ISegment> {
e06c9955 27
fb042960 28 private final Random fRandom = new Random(10);
ae2cf482
MK
29
30 /**
fb042960 31 * Constructor
ae2cf482 32 */
fb042960
GB
33 public SegmentStoreStatisticsTest() {
34 super(s -> s.getLength());
ae2cf482
MK
35 }
36
fb042960
GB
37 @Override
38 protected Collection<@NonNull ISegment> createElementsWithValues(Collection<@NonNull Long> longFixture) {
39 return longFixture.stream()
40 .map(l -> {
41 long nextStart = fRandom.nextInt(10000000);
42 long nextEnd = nextStart + l;
43 // Check the boundaries, it is random after all, so if
44 // there's an overflow, just take the max value as end time
45 if (nextEnd < nextStart) {
46 nextEnd = Long.MAX_VALUE;
47 nextStart = nextEnd - l;
48 }
49 return new BasicSegment(nextStart, nextEnd);
50 })
51 .collect(Collectors.toList());
381e1541 52
381e1541
MK
53 }
54
fb042960
GB
55 @Override
56 public void testLimitDataset2() {
57 /* ISegments do not support negative values */
381e1541
MK
58 }
59
fb042960
GB
60 @Override
61 public void testLargeDatasetNegative() {
62 /* ISegments do not support negative values */
381e1541
MK
63 }
64
e06c9955 65}
This page took 0.03911 seconds and 5 git commands to generate.