Example #1
0
        public void DecodeIntegerNegativeNumberValid()
        {
            int actual   = BCoder.DecodeInteger("i-9e");
            int expected = -9;

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void DecodeIntegerZeroValid()
        {
            int actual   = BCoder.DecodeInteger("i0e");
            int expected = 0;

            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void DecodeIntegerValidNumber()
        {
            int actual   = BCoder.DecodeInteger("i95e");
            int expected = 95;

            Assert.AreEqual(expected, actual);
        }
Example #4
0
 public void DecodeIntegerEmptyInputInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Example #5
0
 public void DecodeIntegerJustMinusInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("i-e");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Example #6
0
 public void DecodeIntegerStartWithZeroInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("i09e");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Example #7
0
 public void DecodeIntegerNegativeZeroInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("i-0e");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Example #8
0
 public void DecodeIntegerFakeStringInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("i293920oejdjd203e");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }
Example #9
0
 public void DecodeIntegerGarbageStringInvalid()
 {
     try
     {
         int actual = BCoder.DecodeInteger("sj1s910j9101uj3901");
         Assert.Fail();
     }
     catch (ArgumentException)
     {
     }
 }