-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_export.dart
More file actions
38 lines (30 loc) · 1.13 KB
/
debug_export.dart
File metadata and controls
38 lines (30 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import 'dart:io';
import 'package:gedcom_parser/src/services/gedcom_parser.dart';
import 'package:gedcom_parser/src/services/gedcom_exporter.dart';
void main() {
final file = File('test/src/5/555SAMPLE.ged');
final lines = file.readAsLinesSync();
final parser = GedcomParser();
final data = parser.parseLines(lines);
final exporter = GedcomExporter();
final exported = exporter.export(data);
final exportedLines = exported.split('\n');
// Remove trailing empty line if any
if (exportedLines.isNotEmpty && exportedLines.last.isEmpty) {
exportedLines.removeLast();
}
print('Original lines: ${lines.length}');
print('Exported lines: ${exportedLines.length}');
print('\n--- Comparison ---');
final maxLength =
lines.length > exportedLines.length ? lines.length : exportedLines.length;
for (var i = 0; i < maxLength; i++) {
final original = i < lines.length ? lines[i] : 'MISSING';
final exported = i < exportedLines.length ? exportedLines[i] : 'MISSING';
if (original != exported) {
print('Line ${i + 1}:');
print(' Original: "$original"');
print(' Exported: "$exported"');
}
}
}