49 lines
1.3 KiB
Dart
49 lines
1.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:libac_dart/utils/IOTools.dart';
|
|
import 'package:test/expect.dart';
|
|
import 'package:test/scaffolding.dart';
|
|
|
|
Future<void> main() async {
|
|
test("Test file size checking", () async {
|
|
expect(await getFileSize("test/hello_world.nbt"), 33);
|
|
expect(await getFileSize("test/bigtest.nbt"), 507);
|
|
});
|
|
|
|
test("Test directory size checking", () async {
|
|
expect(await getDirectorySize("test"), 13118);
|
|
});
|
|
|
|
test("Test file info methods", () async {
|
|
FileInfo fi = FileInfo(path: "C:\\test.txt", size: 4096, isFile: true);
|
|
expect(fi.toString(), "4.0 KB");
|
|
});
|
|
|
|
test("Test ordered file info lists", () async {
|
|
await getDirectorySize("test", cacheSize: true);
|
|
FileInformationCache FIC = FileInformationCache.obtain();
|
|
var list = await FIC.getOrderedList(ascending: false);
|
|
var ascList = await FIC.getOrderedList(ascending: true);
|
|
|
|
print(list);
|
|
print(ascList);
|
|
|
|
expect(list[0].size > ascList[0].size, true);
|
|
expect(list[list.length - 1].size == ascList[0].size, true);
|
|
});
|
|
|
|
test("Test prnt", () async {
|
|
try {
|
|
var i = stdout.terminalColumns;
|
|
} catch (E) {
|
|
expect(1, 1);
|
|
return;
|
|
}
|
|
await prnt("> Processing");
|
|
await prnt("> Process..\r");
|
|
await prnt("> Please stand by...\r");
|
|
await prnt("\rComplete!\n");
|
|
|
|
expect(1, 1);
|
|
});
|
|
}
|