using Nyanbyte.Sysnya.Binary; namespace Nyanbyte.Sysnya.CoreTests.Binary; public class BinaryReaderTests { [Fact] public void BinaryEnumeratorReadTestsBigEndian() { // Given byte[] memory = { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; BinaryEnumerator reader = new(memory, true); // When reader.ReadInt32(out int valA); reader.ReadInt32(out int valB); reader.ReadInt64(out long valC); // Then Assert.Equal(0x1, valA); Assert.Equal(0x1000000, valB); Assert.Equal(0x1, valC); } [Fact] public void BinaryEnumeratorReadTestsLittleEndian() { // Given byte[] memory = { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; BinaryEnumerator reader = new(memory, false); // When reader.ReadInt32(out int valA); reader.ReadInt32(out int valB); reader.ReadInt64(out long valC); // Then Assert.Equal(0x1000000, valA); Assert.Equal(0x1, valB); Assert.Equal(0x100000000000000, valC); } }