public void Initialization_TEST() { BinInt bin = new BinInt("", 8); Assert.AreEqual("00000000",bin.StoredInput); bin = new BinInt("ABC", 8); Assert.AreEqual("00000000", bin.StoredInput); }
public BinInt Convert(DecInt input) { long toBeConverted = input.StoredNumber; int bitNumber = input.allowedNumberOfBits; string result = FromDecIntPos(toBeConverted, bitNumber); BinInt output = new BinInt(result, bitNumber); return output; }
public DecInt Convert(BinInt input) { int size = input.allowedNumberOfBits; int convertFromBase = 2; string toBeConverted = input.StoredInput; uint result = ToDecFromIntPos(toBeConverted, convertFromBase); DecInt output = new DecInt(result,size); return output; }
public void ConvertDec_TEST() { dec.StoredNumber = 25; bin = converter.Convert(dec); Assert.AreEqual(8, bin.allowedNumberOfBits); Assert.AreEqual("00011001", bin.StoredInput); dec.StoredNumber = 16; bin = converter.Convert(dec); Assert.AreEqual("00010000", bin.StoredInput); dec.StoredNumber = 1; bin = converter.Convert(dec); Assert.AreEqual("00000001", bin.StoredInput); dec.StoredNumber = 14; bin = converter.Convert(dec); Assert.AreEqual("00001110", bin.StoredInput); dec.StoredNumber = 5; bin = converter.Convert(dec); Assert.AreEqual("00000101", bin.StoredInput); dec.StoredNumber = 41; bin = converter.Convert(dec); Assert.AreEqual("00101001", bin.StoredInput); }
public void Setup() { converter = new ConverterToDec(); bin = new BinInt(); uBin = new UnfixedBinInteger(); hex = new UnfixedPowOfTwoInteger(PowOfTwoBases.BASE_SIXTEEN); oct = new UnfixedPowOfTwoInteger(PowOfTwoBases.BASE_EIGHT); }
//fix this public SignedBinInt Negate(BinInt unsigned) { //string toBeNegated = unsigned.StoredInput; //string result = this.NegateBin(toBeNegated); //SignedBinInt output = new SignedBinInt(input: result, size: unsigned.allowedNumberOfBits); //return output; throw new NotImplementedException(); }