Пример #1
0
        public void InsertNumberMinValueTest()
        {
            NumericFun numericFun = new NumericFun();
            int        expected   = -2147482848;

            Assert.AreEqual(expected, numericFun.InsertNumber(int.MinValue, 800, 0, 12));
        }
Пример #2
0
        public void InsertNumberMaxValueTest()
        {
            NumericFun numericFun = new NumericFun();
            int        expected   = 8191;

            Assert.AreEqual(expected, numericFun.InsertNumber(15, int.MaxValue, 0, 12));
        }
Пример #3
0
        public void InsertNumberSimpleTest3()
        {
            NumericFun numericFun = new NumericFun();
            int        expected   = 120;

            Assert.AreEqual(expected, numericFun.InsertNumber(8, 15, 3, 8));
        }
Пример #4
0
        public void InsertNumberSimpleTest2()
        {
            NumericFun numericFun = new NumericFun();
            int        expected   = 9;

            Assert.AreEqual(expected, numericFun.InsertNumber(8, 15, 0, 0));
        }
Пример #5
0
        public void InsertNumberInvalidBitsPositionTest4()
        {
            NumericFun numericFun = new NumericFun();

            Assert.ThrowsException <ArgumentException>(() => numericFun.InsertNumber(77, 11, 9, 5), "i cannot be bigger than j");
        }
Пример #6
0
        public void InsertNumberInvalidBitsPositionTest3()
        {
            NumericFun numericFun = new NumericFun();

            Assert.ThrowsException <ArgumentException>(() => numericFun.InsertNumber(77, 11, -1, -12), "i cannot be smaller than 0; j cannot be smaller than 0");
        }
Пример #7
0
        public void InsertNumberInvalidBitsPositionTest2()
        {
            NumericFun numericFun = new NumericFun();

            Assert.ThrowsException <ArgumentException>(() => numericFun.InsertNumber(128, 22, 66, 5), "i cannot be bigger than 31");
        }
Пример #8
0
        public void InsertNumberInvalidBitsPositionTest1()
        {
            NumericFun numericFun = new NumericFun();

            Assert.ThrowsException <ArgumentException>(() => numericFun.InsertNumber(19999, 1999, -11, 55), "i cannot be smaller than 0; j cannot be bigger than 31");
        }