Esempio n. 1
0
        public void NormalTestCase()
        {
            uint expected = 10;
            uint actual   = OctalUtility.OctalToUInt("012");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void CheckUpperLimit()
        {
            uint expected = 4294967295;
            uint actual   = OctalUtility.OctalToUInt("37777777777");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void CheckLowerLimit()
        {
            uint expected = 0;
            uint actual   = OctalUtility.OctalToUInt("0");

            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void ParseError()
        {
            uint res = 0;

            try
            {
                res = OctalUtility.OctalToUInt("/asdf");
            }
            catch (System.Exception e)
            {
                StringAssert.Contains(e.Message, "Parse failed - not a valid octal string");
                return;
            }

            Assert.Fail("The expected exception was not thrown.");
        }
Esempio n. 5
0
        public void OutOfBounds()
        {
            uint res = 0;

            try
            {
                res = OctalUtility.OctalToUInt("777777777777");
            }
            catch (System.OverflowException e)
            {
                StringAssert.Contains(e.Message, "Arithmetic operation resulted in an overflow.");
                return;
            }

            Assert.Fail("The expected exception was not thrown.");
        }