Implement NbtIO and some unit tests using the HelloWorld NBT

This commit is contained in:
zontreck 2024-05-05 23:30:27 -07:00
parent 3a3c5f5822
commit c867982482
4 changed files with 67 additions and 0 deletions

17
test/nbt_test.dart Normal file
View file

@ -0,0 +1,17 @@
import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:libac_flutter/nbt/NbtIo.dart';
import 'package:libac_flutter/nbt/impl/CompoundTag.dart';
void main() {
test('read non-compressed helloworld NBT', () async {
print("READING : ${Directory.current.path}/test/hello_world.nbt");
CompoundTag tag =
await NbtIo.read("${Directory.current.path}/test/hello_world.nbt");
expect(tag.getKey(), "hello world");
expect(tag.contains("name"), true);
expect(tag.get("name")!.asString(), "Bananrama");
});
}