Push new test, clean up stream file

This commit is contained in:
zontreck 2024-05-07 12:24:28 -07:00
parent 7d75a2b5f8
commit d4cf453005
2 changed files with 11 additions and 5 deletions

View file

@ -348,10 +348,5 @@ class ByteLayer {
void unsetSetBit(int position, int maskToClear, int maskToSet) {
clearBit(position, maskToClear);
setBit(position, maskToSet);
while (!checkBit(position, maskToSet)) {
clearBit(position, maskToClear);
setBit(position, maskToSet);
}
}
}

View file

@ -41,6 +41,17 @@ void main() {
expect(layer.checkBit(6, 0x30), true);
});
test("Test stream bitflipping", () {
ByteLayer layer = ByteLayer();
layer.writeBytes({0, 255, 80});
layer.setBit(0, 0x10);
layer.unsetSetBit(1, 0x0F, 0x50);
expect(layer.checkBit(0, 0x10), true);
expect(layer.checkBit(1, 0x50), true);
expect(layer.getBit(2), 80);
});
test("Test v3 implementation", () {
var expected =
"3e1b8c8a-efab-381b-ab57-4764c45b0889"; // Minecraft offline UUID : zontreck