Completely rework SNBT Parser

(NOTE: ChatGPT Was used for regex only)
This commit is contained in:
zontreck 2024-08-29 06:55:12 -07:00
parent 7c87ef444f
commit 84192c69db
11 changed files with 150 additions and 107 deletions

View file

@ -108,4 +108,19 @@ void main() {
expect(ID.MSB, 0);
expect(ID.LSB, 0);
});
test("Convert real-world NBT to SNBT and back to NBT", () async {
String OriginFile = "${Directory.current.path}/test/EL-ReducedList.dat";
String OutputSNBT = "${Directory.current.path}/build/el-test.snbt";
String OutputNBT = "${Directory.current.path}/build/el-test.nbt";
CompoundTag tag = await NbtIo.read(OriginFile);
await SnbtIo.writeToFile(OutputSNBT, tag);
expect(File(OutputSNBT).existsSync(), true);
tag = await SnbtIo.readFromFile(OutputSNBT) as CompoundTag;
await NbtIo.write(OutputNBT, tag);
expect(File(OutputNBT).existsSync(), true);
}, timeout: Timeout(Duration(hours: 90)));
}