public static void TestOperatorAndDiffSizes(int t1, int s1, int t2, int s2, string expected, string testOp) { // Arrange var testObj1 = new DataStructures.BitArray.BitArray(s1); var testObj2 = new DataStructures.BitArray.BitArray(s2); // Act testObj1.Compile(t1); testObj2.Compile(t2); DataStructures.BitArray.BitArray result = null; if (testOp.Equals("AND")) { result = testObj1 & testObj2; } else if (testOp.Equals("OR")) { result = testObj1 | testObj2; } else { result = testObj1 ^ testObj2; } // Assert Assert.AreEqual(expected, result.ToString()); }
public static void TestCompileInteger(int number, string expected) { // Arrange var testObj = new DataStructures.BitArray.BitArray(5); // Act testObj.Compile(number); // Assert Assert.AreEqual(expected, testObj.ToString()); }
public static void TestCompileToString(string sequence, string expectedSequence) { // Arrange var testObj = new DataStructures.BitArray.BitArray(5); // Act testObj.Compile(sequence); // Assert Assert.AreEqual(expectedSequence, testObj.ToString()); }
public static void TestOperatorShiftRight(int number, string expected) { // Arrange var testObj = new DataStructures.BitArray.BitArray(5); // Act testObj.Compile(number); testObj >>= 2; // Assert Assert.AreEqual(expected, testObj.ToString()); }