V3-04 through V3-07, V3-10, V3-16 shipped complete; V3-11/V3-12/V3-14 shipped code-complete pending device/account verification; V3-08/V3-09 deferred behind a new V3-17 (self-hosted OSRM investigation). 316 tests passing, up from 221. The APK is a fresh release build (debug-signed, no release signing config exists yet) with two build fixes applied: core library desugaring enabled for flutter_local_notifications, and sentry_flutter bumped to 9.27.0 (8.14.2's bundled Kotlin plugin was incompatible with this project's Kotlin 2.4.0 toolchain).
65 lines
2.8 KiB
Dart
65 lines
2.8 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:rippr/src/domain/activity_profile.dart';
|
|
import 'package:rippr/src/domain/models.dart';
|
|
import 'package:rippr/src/telemetry/telemetry.dart';
|
|
|
|
/// Ported concept check for V3-01: activity type must drive real behaviour, not just a
|
|
/// label.
|
|
void main() {
|
|
test(
|
|
'the motorcycle profile reproduces the constants the app shipped with before '
|
|
'activity type existed',
|
|
() {
|
|
// ActivityProfile.motorcycle deliberately duplicates these as literals rather than
|
|
// importing them, to avoid a domain-layer dependency cycle -- this is the promised
|
|
// check that the two never drift apart silently.
|
|
expect(ActivityProfile.motorcycle.noiseFloorKmh, speedNoiseFloorKmh);
|
|
expect(ActivityProfile.motorcycle.elevationThresholdM, 3.0);
|
|
expect(ActivityProfile.motorcycle.elevationWindowSamples, 15);
|
|
expect(ActivityProfile.motorcycle.accuracyGateM, 50.0);
|
|
expect(ActivityProfile.motorcycle.histogramBucketKmh, 10);
|
|
},
|
|
);
|
|
|
|
test('forActivity covers every Activity value with no fallback surprises', () {
|
|
for (final activity in Activity.values) {
|
|
// Must not throw -- an unhandled case here would be a runtime crash on a
|
|
// brand-new trip, not a compile error, since the switch is exhaustive over the
|
|
// enum today but a future Activity value could slip through review.
|
|
expect(() => ActivityProfile.forActivity(activity), returnsNormally);
|
|
}
|
|
});
|
|
|
|
test('slower activities get a lower noise floor than a motorcycle', () {
|
|
final motorcycle = ActivityProfile.forActivity(Activity.motorcycle);
|
|
final walking = ActivityProfile.forActivity(Activity.walking);
|
|
final running = ActivityProfile.forActivity(Activity.running);
|
|
|
|
expect(walking.noiseFloorKmh, lessThan(motorcycle.noiseFloorKmh));
|
|
expect(running.noiseFloorKmh, lessThan(motorcycle.noiseFloorKmh));
|
|
expect(
|
|
walking.noiseFloorKmh,
|
|
lessThan(running.noiseFloorKmh),
|
|
reason: 'a walk is slower than a run, so real movement sits even closer to noise',
|
|
);
|
|
});
|
|
|
|
test('running and walking use a finer speed histogram than a motorcycle', () {
|
|
// 10 km/h bands are useless for an activity that rarely exceeds 10 km/h at all.
|
|
expect(ActivityProfile.forActivity(Activity.running).histogramBucketKmh, 1);
|
|
expect(ActivityProfile.forActivity(Activity.walking).histogramBucketKmh, 1);
|
|
expect(ActivityProfile.forActivity(Activity.motorcycle).histogramBucketKmh, 10);
|
|
});
|
|
|
|
test('scooter and other fall back to the safest generic profile', () {
|
|
expect(
|
|
ActivityProfile.forActivity(Activity.scooter),
|
|
same(ActivityProfile.motorcycle),
|
|
);
|
|
expect(
|
|
ActivityProfile.forActivity(Activity.other),
|
|
same(ActivityProfile.motorcycle),
|
|
);
|
|
});
|
|
}
|