23 lines
943 B
Dart
23 lines
943 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:friendly_map/modules/platform_android/src/df_parser.dart';
|
|
|
|
void main() {
|
|
test('안드로이드 df 출력에서 사용률을 읽는다', () {
|
|
const out = 'Filesystem 1K-blocks Used Available Use% Mounted on\n'
|
|
'/dev/block/dm-6 118000000 69000000 48000000 59% /data\n';
|
|
expect(parseDfUsedPercent(out), 59);
|
|
});
|
|
|
|
test('열 이름이 다른 형태와 줄바꿈이 섞여도 읽는다', () {
|
|
expect(parseDfUsedPercent('Filesystem 1K-blocks Used Avail Capacity Mounted\ntmpfs 100 10 90 10% /x\n\n'), 10);
|
|
expect(parseDfUsedPercent('a b\nc 1 2 3 100% /y'), 100);
|
|
});
|
|
|
|
test('읽을 수 없으면 null', () {
|
|
expect(parseDfUsedPercent(''), null);
|
|
expect(parseDfUsedPercent('Filesystem only'), null);
|
|
expect(parseDfUsedPercent('h\nrow 1 2 3 xx% /z'), null);
|
|
expect(parseDfUsedPercent('h\nrow 1 2 3 150% /z'), null);
|
|
});
|
|
}
|