public void TryReadLabel(string code, bool expected) { var target = new AssemblerInstance(code, memoryMock.Object); bool result = target.TryReadLabelDefinition(); Assert.AreEqual(expected, result); }
public void TryReadName(string code, string expectedName) { var target = new AssemblerInstance(code, memoryMock.Object); bool result = target.TryReadName(out string actualName); if (expectedName == null) { Assert.IsFalse(result); } else { Assert.IsTrue(result); Assert.AreEqual(expectedName, actualName); } }
public void TryReadRegister(string code, int?expectedRegister) { var target = new AssemblerInstance(code, memoryMock.Object); bool result = target.TryReadRegister(out int actualRegister); if (expectedRegister == null) { Assert.IsFalse(result); } else { Assert.IsTrue(result); Assert.AreEqual(expectedRegister, actualRegister); } }
public void TryReadAsciiString(string code, byte[] expectedValue) { var target = new AssemblerInstance(code, memoryMock.Object); bool result = target.TryReadAsciiString(out byte[] actualValue); if (expectedValue == null) { Assert.IsFalse(result); } else { Assert.IsTrue(result); CollectionAssert.AreEqual(expectedValue, actualValue); } }
public void TryReadUnsigned(string code, uint?expected) { var target = new AssemblerInstance(code, memoryMock.Object); bool result = target.TryReadUnsigned(32, out uint actual); if (expected == null) { Assert.IsFalse(result); } else { Assert.IsTrue(result); Assert.AreEqual(expected, actual); } }