2024-08-24 07:02:52 -07:00
|
|
|
import 'dart:io';
|
|
|
|
|
2024-08-24 00:01:12 -07:00
|
|
|
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 {
|
2024-08-29 16:25:28 -07:00
|
|
|
expect(await getDirectorySize("test"), 13118);
|
2024-08-24 00:01:12 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
2024-08-24 07:02:52 -07:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
2024-08-24 00:01:12 -07:00
|
|
|
}
|