Ejemplo n.º 1
0
 public void FakeBinary_ConvertToFakeBinary_BasicTests()
 {
     Assert.AreEqual("01011110001100111", FakeBinary.ConvertToFakeBinary("45385593107843568"));
     Assert.AreEqual("101000111101101", FakeBinary.ConvertToFakeBinary("509321967506747"));
     Assert.AreEqual("011011110000101010000011011", FakeBinary.ConvertToFakeBinary("366058562030849490134388085"));
     Assert.AreEqual("01111100", FakeBinary.ConvertToFakeBinary("15889923"));
     Assert.AreEqual("100111001111", FakeBinary.ConvertToFakeBinary("800857237867"));
 }
Ejemplo n.º 2
0
        public void FakeBinary_ConvertToFakeBinary_RandomTests()
        {
            var rand = new Random();

            for (var i = 0; i < 100; i++)
            {
                var len = rand.Next(1, 30);

                var x = String.Concat(Enumerable.Range(0, len).Select(a => rand.Next(0, 10).ToString()).ToArray());

                var expected = string.Concat(x.Select(a => a < '5' ? "0" : "1"));;
                Assert.AreEqual(expected, FakeBinary.ConvertToFakeBinary(x));
            }
        }
Ejemplo n.º 3
0
 public void BasicTests()
 {
     Assert.AreEqual("01011110001100111", FakeBinary.FakeBin("45385593107843568"));
     Assert.AreEqual("101000111101101", FakeBinary.FakeBin("509321967506747"));
     Assert.AreEqual("011011110000101010000011011", FakeBinary.FakeBin("366058562030849490134388085"));
 }