Implement basic SNBT reader and testsuite

This commit is contained in:
zontreck 2024-06-06 14:14:13 -07:00
parent 396c660113
commit a0f372693b
17 changed files with 352 additions and 2 deletions

View file

@ -82,12 +82,19 @@ void main() {
await NbtIo.read("${Directory.current.path}/test/bigtest.nbt");
String output = "${Directory.current.path}/build/bigtest.snbt";
File file = File(output);
SnbtIo.write(output, ct);
SnbtIo.writeToFile(output, ct);
// Expect that the file exists
expect(file.existsSync(), true);
});
test("Read BigTest from SNBT file", () async {
CompoundTag tag = await SnbtIo.readFromFile(
"${Directory.current.path}/build/bigtest.snbt") as CompoundTag;
expect(tag.containsKey("stringTest"), true);
});
test("Write NULL UUID to NBT", () async {
CompoundTag tag = CompoundTag();
NbtUtils.writeUUID(tag, "test", NbtUUID.fromUUID(UUID.ZERO));