public void VerifyEqualOperatorTest3() { byte[] first = new byte[] { 1, 1, 1, 1 }; byte[] second = new byte[] { 1, 1, 1, 0 }; bool areEqual = OperationsOnBases.OperatorEqual(first, second); Assert.AreEqual(false, areEqual); }
public void VerifyBitwiseNOToperatorForAnumber() { byte[] number = new byte[] { 1, 0, 0, 1, 1 }; byte[] expectednumber = new byte[] { 0, 1, 1, 0, 0 }; byte[] resultedNumber = OperationsOnBases.OperatorNot(number); CollectionAssert.AreEqual(expectednumber, resultedNumber); }
public void VerifyGreaterThanOperatorTest3() { byte[] first = new byte[] { 1, 1, 1, 1 }; byte[] second = new byte[] { 1, 1, 1, 0 }; bool firstNumberIsGreater = OperationsOnBases.OperatorGreaterThan(first, second); Assert.AreEqual(true, firstNumberIsGreater); }
public void VerifyLessThanOperatorTest3() { byte[] first = new byte[] { 0, 1, 1, 0 }; byte[] second = new byte[] { 1, 1, 1, 1 }; bool firstNumberIsLess = OperationsOnBases.OperatorLessThan(first, second); Assert.AreEqual(true, firstNumberIsLess); }
public void VerifyBitwiseXORoperatorFornumbers() { byte[] first = new byte[] { 1, 0, 0, 1, 1 }; byte[] second = new byte[] { 0, 0, 1, 1, 1 }; byte[] expectednumber = new byte[] { 1, 0, 1, 0, 0 }; byte[] resultedNumber = OperationsOnBases.OperatorXOR(first, second); CollectionAssert.AreEqual(expectednumber, resultedNumber); }
public void VerifyTransformationOfaNumberFromADifferentBaseIntoDecimal3() { byte[] number = { 1, 0 }; int baseNumber = 2; double expectedNumber = 2; double decimalNumber = OperationsOnBases.ConvertToDecimalNumber(number, baseNumber); Assert.AreEqual(expectedNumber, decimalNumber); }
public void VerifyDivisionBetweenTwonumbersTest2() { byte[] first = new byte[] { 7, 2 }; byte[] second = new byte[] { 5 }; byte[] expectedResult = new byte[] { 1, 3 }; int baseNumber = 8; byte[] division = OperationsOnBases.OperationDivision(first, second, baseNumber); CollectionAssert.AreEqual(expectedResult, division); }
public void VerifyMultiplicationBetweenTwonumbers4() { byte[] first = new byte[] { 7, 2, 5 }; byte[] second = new byte[] { 4, 2 }; byte[] expectedResult = new byte[] { 3, 7, 1, 1, 2 }; int baseNumber = 8; byte[] multiplication = OperationsOnBases.OperationMultiply(first, second, baseNumber); CollectionAssert.AreEqual(expectedResult, multiplication); }
public void VerifyOperationSubstractionBetweenTwonumbers5() { byte[] first = new byte[] { 7, 6, 5 }; byte[] second = new byte[] { 4, 3 }; byte[] expectedResult = new byte[] { 7, 2, 2 }; int baseNumber = 8; byte[] result = OperationsOnBases.OperationSubstraction(first, second, baseNumber); CollectionAssert.AreEqual(expectedResult, result); }
public void VerifyOperationSubstractionBetweenTwonumbers4() { byte[] first = new byte[] { 1, 0, 0, 0 }; byte[] second = new byte[] { 1, 0 }; byte[] expectedResult = new byte[] { 0, 1, 1, 0 }; int baseNumber = 2; byte[] result = OperationsOnBases.OperationSubstraction(first, second, baseNumber); CollectionAssert.AreEqual(expectedResult, result); }
public void VerifyAdditionBetweenTwonumbersTest4() { byte[] first = new byte[] { 7, 0, 6, 1 }; byte[] second = new byte[] { 7, 1, 1 }; byte[] expectedSum = new byte[] { 7, 7, 7, 2 }; int baseNumber = 8; byte[] sum = OperationsOnBases.OperationAddition(first, second, baseNumber); CollectionAssert.AreEqual(expectedSum, sum); }
public void VerifyBitwiseLeftHandShiftOperatorFornumbers() { byte[] number = new byte[] { 1, 0, 0, 1, 1, 0, 1, 0 }; int value = 2; byte[] expectednumber = new byte[] { 0, 1, 1, 0, 1, 0, 0, 0 }; byte[] resultedNumber = OperationsOnBases.OperatorLeftHandShift(number, value); CollectionAssert.AreEqual(expectednumber, resultedNumber); }
public void TransformDecimalNumberToBaseTwo() { int decimalNumber = 12; int baseNumber = 2; byte[] expectedNumber = new byte[] { 1, 1, 0, 0 }; byte[] convertedNumber = OperationsOnBases.ConvertADecimalNumberIntoAnotherBase(decimalNumber, baseNumber); CollectionAssert.AreEqual(expectedNumber, convertedNumber); }
public void VerifyNotEqualOperator() { byte[] first = new byte[] { 1, 1, 1, 0 }; byte[] second = new byte[] { 1, 1, 1 }; bool firstNumberIsLess = OperationsOnBases.OperatorLessThan(first, second); bool secondNumberIsLess = OperationsOnBases.OperatorLessThan(second, first); bool areEqual = false; if ((firstNumberIsLess == false) & (secondNumberIsLess == false)) { areEqual = true; } Assert.AreEqual(false, areEqual); }