Remote sync of webdav
This commit is contained in:
parent
f01186df79
commit
483fbeafb6
44 changed files with 4842 additions and 975 deletions
47
test/vin_parser_test.dart
Normal file
47
test/vin_parser_test.dart
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fuel_tax_tracker/services/vin_parser.dart';
|
||||
|
||||
void main() {
|
||||
group('VinParser', () {
|
||||
test('parses a bare 17-character VIN', () {
|
||||
const text = '''
|
||||
VEHICLE IDENTIFICATION NUMBER
|
||||
1HGCM82633A004352
|
||||
MFD BY HONDA MFG CO
|
||||
''';
|
||||
|
||||
expect(VinParser.parse(text), '1HGCM82633A004352');
|
||||
});
|
||||
|
||||
test('prefers a "VIN:" labeled match over another candidate elsewhere', () {
|
||||
const text = '''
|
||||
PART NO 4F2CZ58899BA12345
|
||||
VIN: 1HGCM82633A004352
|
||||
''';
|
||||
|
||||
expect(VinParser.parse(text), '1HGCM82633A004352');
|
||||
});
|
||||
|
||||
test('normalizes to uppercase', () {
|
||||
expect(VinParser.parse('vin: 1hgcm82633a004352'), '1HGCM82633A004352');
|
||||
});
|
||||
|
||||
test('does not match a run containing I, O, or Q (never valid in a real VIN)', () {
|
||||
// Same length (17) but contains an "O" partway through, so no
|
||||
// 17-character eligible-charset run exists anywhere in it.
|
||||
expect(VinParser.parse('1HGCM82633AOO4352'), isNull);
|
||||
});
|
||||
|
||||
test('does not match a 16-character (too short) run', () {
|
||||
expect(VinParser.parse('1HGCM82633A00435'), isNull);
|
||||
});
|
||||
|
||||
test('does not match an 18-character (too long) run', () {
|
||||
expect(VinParser.parse('1HGCM82633A0043521'), isNull);
|
||||
});
|
||||
|
||||
test('returns null when nothing matches', () {
|
||||
expect(VinParser.parse('THANK YOU FOR YOUR PURCHASE'), isNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue