first commit
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sign_checker/domain/detection_stabilizer.dart';
|
||||
import 'package:sign_checker/domain/norm_rect.dart';
|
||||
|
||||
void main() {
|
||||
SignDetection hit(String label) {
|
||||
return SignDetection(
|
||||
rawLabel: label,
|
||||
confidence: 0.9,
|
||||
box: const NormRect(0.1, 0.1, 0.2, 0.2),
|
||||
);
|
||||
}
|
||||
|
||||
test('a sign is shown only after a second hit and dropped after misses', () {
|
||||
final stabilizer = DetectionStabilizer();
|
||||
expect(stabilizer.update([hit('3.27')]), isEmpty);
|
||||
final visible = stabilizer.update([hit('3.27')]);
|
||||
expect(visible, hasLength(1));
|
||||
expect(visible.single.rawLabel, '3.27');
|
||||
|
||||
expect(stabilizer.update(const []), hasLength(1));
|
||||
expect(stabilizer.update(const []), isEmpty);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user