Example #1
0
        public void AddBinaryTestMethod()
        {
            AddBinary ab = new AddBinary();

            Assert.AreEqual("100", ab.AddBinarysln("11", "1"));
            Assert.AreEqual("11110", ab.AddBinarysln("1111", "1111"));
        }
Example #2
0
        public void TestAddBinary()
        {
            var r = AddBinary.Get("1010", "1011");

            Assert.AreEqual(r, "10101");

            r = AddBinary.Get("111", "111111");
            Assert.AreEqual(r, "1000110");
        }
        public void Excution1Test()
        {
            var func = new AddBinary();

            Assert.AreEqual("100", func.Excution1("11", "1"));
            Assert.AreEqual("10101", func.Excution1("1010", "1011"));
            Assert.AreEqual("1", func.Excution1("0", "1"));
            Assert.AreEqual("110", func.Excution1("11", "11"));
            Assert.AreEqual("1100", func.Excution1("1011", "1"));
        }
Example #4
0
 public void CornerCases()
 {
     Assert.AreEqual("11", AddBinary.Add(null, "11"));
     Assert.AreEqual("11", AddBinary.Add("11", null));
     Assert.AreEqual("11", AddBinary.Add(string.Empty, "11"));
     Assert.AreEqual("11", AddBinary.Add("11", string.Empty));
     Assert.AreEqual("10", AddBinary.Add("1", "1"));
     Assert.AreEqual("1", AddBinary.Add("1", "0"));
     Assert.AreEqual("1", AddBinary.Add("0", "1"));
     Assert.AreEqual("0", AddBinary.Add("0", "0"));
 }
        public void BinaryStringOnePlusZeroIsOne()
        {
            //Arrange
            var addBinary = new AddBinary();

            //Act
            var binaryMath = addBinary.Add("1", "0");

            //Assert

            Assert.Equal("1", binaryMath);
        }
        public void BinaryStringFourPlusZeroIsFour()
        {
            //Arrange
            var addBinary = new AddBinary();

            //Act
            var binaryMath = addBinary.Add("0100", "0");

            //Assert

            Assert.Equal("0100", binaryMath);
        }
Example #7
0
 public void FirstTestCase()
 {
     Assert.Equal("11", AddBinary.Test(1, 2));
 }
Example #8
0
 public void NormalCases()
 {
     Assert.AreEqual("100", AddBinary.Add("11", "1"));
 }
Example #9
0
        public string AddBinary(string a, string b)
        {
            var addBin = new AddBinary(a, b);

            return(addBin.SolutionOne());
        }