Esempio n. 1
0
        public void MyArray1()
        {
            var expected = new int[] { 24, 30, 40, 60, 120 };
            var actual   = Greedy.GetProductsOfAllIntsExceptAtIndex(new int[] { 5, 4, 3, 2, 1 });

            Assert.Equal(expected, actual);
        }
Esempio n. 2
0
        public void AllNegativesInputTest()
        {
            var expected = new int[] { -8, -56, -14, -28 };
            var actual   = Greedy.GetProductsOfAllIntsExceptAtIndex(new int[] { -7, -1, -4, -2 });

            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
        public void InputHasOneNegativeNumberTest()
        {
            var expected = new int[] { 32, -12, -24 };
            var actual   = Greedy.GetProductsOfAllIntsExceptAtIndex(new int[] { -3, 8, 4 });

            Assert.Equal(expected, actual);
        }
Esempio n. 4
0
        public void InputHasTwoZerosTest()
        {
            var expected = new int[] { 0, 0, 0, 0, 0 };
            var actual   = Greedy.GetProductsOfAllIntsExceptAtIndex(new int[] { 4, 0, 9, 1, 0 });

            Assert.Equal(expected, actual);
        }
Esempio n. 5
0
        public void InputHasOneZeroTest()
        {
            var expected = new int[] { 0, 0, 36, 0 };
            var actual   = Greedy.GetProductsOfAllIntsExceptAtIndex(new int[] { 6, 2, 0, 3 });

            Assert.Equal(expected, actual);
        }
Esempio n. 6
0
        public void LongArrayInputTest()
        {
            var expected = new int[] { 120, 480, 240, 320, 960, 192 };
            var actual   = Greedy.GetProductsOfAllIntsExceptAtIndex(new int[] { 8, 2, 4, 3, 1, 5 });

            Assert.Equal(expected, actual);
        }
Esempio n. 7
0
        public void SmallArrayInputTest()
        {
            var expected = new int[] { 6, 3, 2 };
            var actual   = Greedy.GetProductsOfAllIntsExceptAtIndex(new int[] { 1, 2, 3 });

            Assert.Equal(expected, actual);
        }
Esempio n. 8
0
 public void ExceptionWithOneNumberInputTest()
 {
     Assert.Throws <ArgumentException>(() => Greedy.GetProductsOfAllIntsExceptAtIndex(new int[] { 1 }));
 }