Push more utilities and UUID stuff

This commit is contained in:
zontreck 2024-05-06 20:49:48 -07:00
parent dd6ee1bf60
commit 9b7b84153f
7 changed files with 325 additions and 0 deletions

View file

@ -2,8 +2,10 @@ import 'dart:io';
import 'package:flutter_test/flutter_test.dart';
import 'package:libac_flutter/nbt/NbtIo.dart';
import 'package:libac_flutter/nbt/NbtUtils.dart';
import 'package:libac_flutter/nbt/impl/CompoundTag.dart';
import 'package:libac_flutter/nbt/impl/StringTag.dart';
import 'package:libac_flutter/utils/uuid/UUID.dart';
void main() {
test('read non-compressed helloworld NBT', () async {
@ -44,4 +46,13 @@ void main() {
expect(tag.get("doubleTest")!.asDouble(), 0.4931287132182315);
expect(tag.get("floatTest")!.asFloat(), 0.49823147);
});
test("Generate a UUID v4, save to NBT, and read it back again", () async {
var id = UUID.generate(4);
CompoundTag tag = CompoundTag();
NbtUtils.writeUUID(tag, "test", id);
var newID = NbtUtils.readUUID(tag, "test");
expect(id.toString(), newID.toString());
});
}