public void ConvertUnsignedHex()
 {
     hex = new UnfixedPowOfTwoInteger(PowOfTwoBases.BASE_SIXTEEN, "");
     hex.StoredInput = "4";
     ubin = converter.Convert(hex);
     Assert.AreEqual("100", ubin.StoredInput);
     hex.StoredInput = "8";
     ubin = converter.Convert(hex);
     Assert.AreEqual("1000", ubin.StoredInput);
     hex.StoredInput = "A";
     ubin = converter.Convert(hex);
     Assert.AreEqual("1010", ubin.StoredInput);
     hex.StoredInput = "b";
     ubin = converter.Convert(hex);
     Assert.AreEqual("1011", ubin.StoredInput);
     hex.StoredInput = "C";
     ubin = converter.Convert(hex);
     Assert.AreEqual("1100", ubin.StoredInput);
     hex.StoredInput = "d";
     ubin = converter.Convert(hex);
     Assert.AreEqual("1101", ubin.StoredInput);
     hex.StoredInput = "56";
     ubin = converter.Convert(hex);
     Assert.AreEqual("1010110", ubin.StoredInput);
     hex.StoredInput = "ef";
     ubin = converter.Convert(hex);
     Assert.AreEqual("11101111", ubin.StoredInput);
 }
        public UnfixedDecInteger Convert(UnfixedBinInteger input)
        {
            uint result = SetUpConvert(input, (int)NumberBases.BASE_TWO);

            UnfixedDecInteger output = new UnfixedDecInteger(result);

            return output;
        }
 public void DeleteChar_TEST()
 {
     UnfixedBinInteger bin = new UnfixedBinInteger("");
     bin.DeleteCharFromBack();
     Assert.AreEqual("0", bin.StoredInput);
     bin.StoredInput = "101";
     bin.DeleteCharFromBack();
     Assert.AreEqual("10", bin.StoredInput);
 }
 public void ClearInput_TEST()
 {
     UnfixedBinInteger bin = new UnfixedBinInteger("");
     bin.ClearInput();
     Assert.AreEqual("0", bin.StoredInput);
     bin.StoredInput = "101";
     bin.ClearInput();
     Assert.AreEqual("0", bin.StoredInput);
 }
 public void SetStoredInput_TEST()
 {
     UnfixedBinInteger bin = new UnfixedBinInteger("");
     bin.StoredInput = "";
     Assert.AreEqual("0",bin.StoredInput);
     bin.StoredInput = "1";
     Assert.AreEqual("1", bin.StoredInput);
     bin.StoredInput = "";
     Assert.AreEqual("0", bin.StoredInput);
     bin.StoredInput = "1010";
     Assert.AreEqual("1010", bin.StoredInput);
     bin.StoredInput = "000";
     Assert.AreEqual("0", bin.StoredInput);
     bin.StoredInput = "1111";
     Assert.AreEqual("1111", bin.StoredInput);
 }
 public void Initialization_TEST()
 {
     UnfixedBinInteger bin = new UnfixedBinInteger("");
     Assert.AreEqual("0", bin.StoredInput);
     bin = new UnfixedBinInteger("1");
     Assert.AreEqual("1", bin.StoredInput);
     bin = new UnfixedBinInteger("0");
     Assert.AreEqual("0", bin.StoredInput);
     bin = new UnfixedBinInteger("101");
     Assert.AreEqual("101", bin.StoredInput);
     bin = new UnfixedBinInteger("ABC");
     Assert.AreEqual("0", bin.StoredInput);
     bin = new UnfixedBinInteger("3");
     Assert.AreEqual("0", bin.StoredInput);
     bin = new UnfixedBinInteger("9");
     Assert.AreEqual("0", bin.StoredInput);
     bin = new UnfixedBinInteger("0000");
     Assert.AreEqual("0", bin.StoredInput);
 }
 public void AddChar_TEST()
 {
     UnfixedBinInteger bin = new UnfixedBinInteger("");
     bin.AddChar('1');
     Assert.AreEqual("1", bin.StoredInput);
     bin.AddChar('1');
     Assert.AreEqual("11", bin.StoredInput);
     bin.StoredInput = "0";
     bin.AddChar('1');
     Assert.AreEqual("1", bin.StoredInput);
     bin.StoredInput = "0";
     bin.AddChar('0');
     Assert.AreEqual("0", bin.StoredInput);
     bin.AddChar('a');
     Assert.AreEqual("0", bin.StoredInput);
     bin.StoredInput = "110110";
     bin.AddChar('a');
     Assert.AreEqual("110110", bin.StoredInput);
 }
 private UnfixedBinInteger UDecToUBin(UnfixedDecInteger udec)
 {
     ConverterToAny converterAny = new ConverterToAny();
     UnfixedAnyInteger any = converterAny.Convert(udec, NumberBases.BASE_TWO);
     UnfixedBinInteger ubin = new UnfixedBinInteger(any.StoredInput);
     return ubin;
 }
 public void Setup()
 {
     converter = new ConverterToDec();
     bin = new BinInt();
     uBin = new UnfixedBinInteger();
     hex = new UnfixedPowOfTwoInteger(PowOfTwoBases.BASE_SIXTEEN);
     oct = new UnfixedPowOfTwoInteger(PowOfTwoBases.BASE_EIGHT);
 }
 public void ConvertUnsignedOct()
 {
     oct = new UnfixedPowOfTwoInteger(PowOfTwoBases.BASE_EIGHT);
     oct.StoredInput = "4";
     ubin = converter.Convert(oct);
     Assert.AreEqual("100", ubin.StoredInput);
     oct.StoredInput = "10";
     ubin = converter.Convert(oct);
     Assert.AreEqual("1000", ubin.StoredInput);
     oct.StoredInput = "42";
     ubin = converter.Convert(oct);
     Assert.AreEqual("100010", ubin.StoredInput);
     oct.StoredInput = "377";
     ubin = converter.Convert(oct);
     Assert.AreEqual("11111111", ubin.StoredInput);
 }