use of au.gov.amsa.risky.format.Fix in project risky by amsa-code.
the class DriftDetectorTest method testRule3FourDriftersBigTimeGapBetweenTwoAndThree.
@Test
public void testRule3FourDriftersBigTimeGapBetweenTwoAndThree() {
long t = 0;
// drifter
Fix f1 = createFix(90, DRIFT_SPEED_KNOTS, t);
// drifter
Fix f2 = createFix(91, DRIFT_SPEED_KNOTS, t += 1);
// drifter
Fix f3 = createFix(92, DRIFT_SPEED_KNOTS, t += testOptions.expiryAgeMs() + 1);
// drifter
Fix f4 = createFix(93, DRIFT_SPEED_KNOTS, t += 1);
List<DriftCandidate> list = getCandidates(Observable.just(f1, f2, f3, f4));
assertEquals(4, list.size());
assertTrue(f1 == list.get(0).fix());
assertTrue(f2 == list.get(1).fix());
assertTrue(f3 == list.get(2).fix());
assertTrue(f4 == list.get(3).fix());
assertEquals(f1.time(), list.get(0).driftingSince());
assertEquals(f1.time(), list.get(1).driftingSince());
assertEquals(f3.time(), list.get(2).driftingSince());
assertEquals(f3.time(), list.get(3).driftingSince());
}
use of au.gov.amsa.risky.format.Fix in project risky by amsa-code.
the class DriftDetectorTest method testDriftedFalseIfNoCog.
@Test
public void testDriftedFalseIfNoCog() {
Fix fix = Mockito.mock(Fix.class);
Mockito.when(fix.courseOverGroundDegrees()).thenReturn(Optional.<Float>empty());
Mockito.when(fix.headingDegrees()).thenReturn(Optional.of(110.0f));
Mockito.when(fix.speedOverGroundKnots()).thenReturn(Optional.of(DRIFT_SPEED_KNOTS));
Mockito.when(fix.navigationalStatus()).thenReturn(Optional.<NavigationalStatus>empty());
assertFalse(DriftDetector.isCandidate(Options.instance()).call(fix));
}
use of au.gov.amsa.risky.format.Fix in project risky by amsa-code.
the class DriftDetectorTest method testRule5TwoDriftersThenTwoNonDrifters.
@Test
public void testRule5TwoDriftersThenTwoNonDrifters() {
long t = 0;
// drifter
Fix f1 = createFix(90, DRIFT_SPEED_KNOTS, t);
// drifter
Fix f2 = createFix(91, DRIFT_SPEED_KNOTS, t += 1);
// non-drifter
Fix f3 = createFix(1, DRIFT_SPEED_KNOTS, t += 1);
// non-drifter
Fix f4 = createFix(2, DRIFT_SPEED_KNOTS, t += 1);
List<DriftCandidate> list = getCandidates(Observable.just(f1, f2, f3, f4));
assertEquals(2, list.size());
assertTrue(f1 == list.get(0).fix());
assertTrue(f2 == list.get(1).fix());
assertEquals(f1.time(), list.get(0).driftingSince());
assertEquals(f1.time(), list.get(1).driftingSince());
}
use of au.gov.amsa.risky.format.Fix in project risky by amsa-code.
the class DriftDetectorTest method testRule6DrifterNonDrifterDrifter.
@Test
public void testRule6DrifterNonDrifterDrifter() {
long t = 0;
// drifter
Fix f1 = createFix(90, DRIFT_SPEED_KNOTS, t);
// non-drifter
Fix f2 = createFix(1, DRIFT_SPEED_KNOTS, t += 1);
// drifter
Fix f3 = createFix(91, DRIFT_SPEED_KNOTS, t += 1);
List<DriftCandidate> list = getCandidates(Observable.just(f1, f2, f3));
assertEquals(2, list.size());
assertTrue(f1 == list.get(0).fix());
assertTrue(f3 == list.get(1).fix());
assertEquals(f1.time(), list.get(0).driftingSince());
assertEquals(f1.time(), list.get(1).driftingSince());
}
use of au.gov.amsa.risky.format.Fix in project risky by amsa-code.
the class DriftDetectorTest method testRule3ThreeDrifters.
@Test
public void testRule3ThreeDrifters() {
long t = 0;
// drifter
Fix f1 = createFix(90, DRIFT_SPEED_KNOTS, t);
// drifter
Fix f2 = createFix(91, DRIFT_SPEED_KNOTS, t += 1);
// drifter
Fix f3 = createFix(92, DRIFT_SPEED_KNOTS, t += 1);
List<DriftCandidate> list = getCandidates(Observable.just(f1, f2, f3));
assertEquals(3, list.size());
assertTrue(f1 == list.get(0).fix());
assertTrue(f2 == list.get(1).fix());
assertTrue(f3 == list.get(2).fix());
assertEquals(f1.time(), list.get(0).driftingSince());
assertEquals(f1.time(), list.get(1).driftingSince());
assertEquals(f1.time(), list.get(2).driftingSince());
}
Aggregations