Esempio n. 1
0
        public void TwoSumTest_LargeArray_NoTarget()
        {
            var target = 19081;

            var solution = new _001_TwoSum();
            var result   = solution.TwoSum(largeArray, target);

            Assert.AreEqual(0, result.Length);
        }
Esempio n. 2
0
        public void TwoSumTest_LargeArray_NoTarget()
        {
            var target = 19081;

            var solution = new _001_TwoSum();
            var result = solution.TwoSum(largeArray, target);

            Assert.AreEqual(0, result.Length);
        }
Esempio n. 3
0
        public void TwoSumTest_NoTarget()
        {
            var nums   = new int[] { 2, 7, 11, 15 };
            var target = 5;

            var solution = new _001_TwoSum();
            var result   = solution.TwoSum(nums, target);

            Assert.AreEqual(0, result.Length);
        }
Esempio n. 4
0
        public void TwoSumTest_LargeArray()
        {
            var target = 19082;

            var solution = new _001_TwoSum();
            var result   = solution.TwoSum(largeArray, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(4770, result[0]);
            Assert.AreEqual(4771, result[1]);
        }
Esempio n. 5
0
        public void TwoSumTest_LargeArray()
        {
            var target = 19082;

            var solution = new _001_TwoSum();
            var result = solution.TwoSum(largeArray, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(4771, result[0]);
            Assert.AreEqual(4772, result[1]);
        }
Esempio n. 6
0
        public void TwoSumTest_AllSame()
        {
            var nums   = new int[] { 5, 5, 5, 5, 5 };
            var target = 10;

            var solution = new _001_TwoSum();
            var result   = solution.TwoSum(nums, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(0, result[0]);
            Assert.AreEqual(1, result[1]);
        }
Esempio n. 7
0
        public void TwoSumTest_Duplicate()
        {
            var nums   = new int[] { 5, 5, 15, 30 };
            var target = 20;

            var solution = new _001_TwoSum();
            var result   = solution.TwoSum(nums, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(1, result[0]);
            Assert.AreEqual(2, result[1]);
        }
Esempio n. 8
0
        public void TwoSumTest_Unordered()
        {
            var nums   = new int[] { 5, 75, 25 };
            var target = 100;

            var solution = new _001_TwoSum();
            var result   = solution.TwoSum(nums, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(1, result[0]);
            Assert.AreEqual(2, result[1]);
        }
Esempio n. 9
0
        public void TwoSumTest_Ordered()
        {
            var nums   = new int[] { 2, 7, 11, 15 };
            var target = 9;

            var solution = new _001_TwoSum();
            var result   = solution.TwoSum(nums, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(0, result[0]);
            Assert.AreEqual(1, result[1]);
        }
Esempio n. 10
0
        public void TwoSumTest_Duplicate()
        {
            var nums = new int[] { 5, 5, 15, 30 };
            var target = 20;

            var solution = new _001_TwoSum();
            var result = solution.TwoSum(nums, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(2, result[0]);
            Assert.AreEqual(3, result[1]);
        }
Esempio n. 11
0
        public void TwoSumTest_AllSame()
        {
            var nums = new int[] { 5, 5, 5, 5, 5 };
            var target = 10;

            var solution = new _001_TwoSum();
            var result = solution.TwoSum(nums, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(1, result[0]);
            Assert.AreEqual(2, result[1]);
        }
Esempio n. 12
0
        public void TwoSumTest_Ordered()
        {
            var nums = new int[] { 2, 7, 11, 15 };
            var target = 9;

            var solution = new _001_TwoSum();
            var result = solution.TwoSum(nums, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(1, result[0]);
            Assert.AreEqual(2, result[1]);
        }
Esempio n. 13
0
        public void TwoSumTest_NoTarget()
        {
            var nums = new int[] { 2, 7, 11, 15 };
            var target = 5;

            var solution = new _001_TwoSum();
            var result = solution.TwoSum(nums, target);

            Assert.AreEqual(0, result.Length);
        }
Esempio n. 14
0
        public void TwoSumTest_Unordered()
        {
            var nums = new int[] { 5, 75, 25 };
            var target = 100;

            var solution = new _001_TwoSum();
            var result = solution.TwoSum(nums, target);

            Assert.AreEqual(2, result.Length);
            Assert.AreEqual(2, result[0]);
            Assert.AreEqual(3, result[1]);
        }