public void MustFindMedianSortedArrays(int[] nums1, int[] nums2, double expected)
        {
            var sut = new MedianOfTwoSortedArrays();

            var result = sut.FindMedianSortedArrays(nums1, nums2);

            result.Should().Be(expected);
        }
        public void TestFindMedianOfTwoSortedArrays()
        {
            var sortedArray1 = new int[] { 1, 2, 3, 8, 10 };
            var sortedArray2 = new int[] { 3, 4, 6, 7 };

            var sortedArraySolver = new MedianOfTwoSortedArrays();
            var median            = sortedArraySolver.FindMedianOfTwoSortedArrays(sortedArray1, sortedArray2);
        }
Пример #3
0
        public void Test_MedianOfTwoSortedArrays()
        {
            int[] num1 = new int[2] {
                1, 2
            };
            int[] num2 = new int[2] {
                3, 4
            };
            double output = MedianOfTwoSortedArrays.FindMedianSortedArrays(num1, num2);

            Assert.AreEqual(2.5, output);
        }
Пример #4
0
        public void Common_Test()
        {
            // Arrange
            var solution = new MedianOfTwoSortedArrays();
            var expected = 2;

            //act
            var result = solution.FindMedianSortedArrays(new[] { 1, 2, 3 }, new[] { 1, 2, 4, 5 });

            //Assert
            Assert.Equal(expected, result);
        }
Пример #5
0
 public void Median_odd_length()
 {
     Assert.Equal(5, MedianOfTwoSortedArrays.FindMedianSortedArray(new [] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }));
 }
Пример #6
0
 public void Array_rank(int[] nums, int x, int rank)
 {
     Assert.Equal(rank, MedianOfTwoSortedArrays.GetSortedArrayRank(x, nums));
 }
Пример #7
0
        public void MedianOfTwoSortedArrays()
        {
            MedianOfTwoSortedArrays MedianOfTwoSortedArrays = new MedianOfTwoSortedArrays();

            MedianOfTwoSortedArrays.FindMedianSortedArrays(new int[] { 1, 3 }, new int[] { 2 });
        }
Пример #8
0
        public void FindMedianOfTwoSortedArraysTests_Returns_ExpectedResult(int[] nums1, int[] nums2, double expected)
        {
            var actual = MedianOfTwoSortedArrays.FindMedianSortedArrays(nums1, nums2);

            Assert.AreEqual(expected, actual);
        }
Пример #9
0
 public MedianOfTwoSortedArraysTests()
 {
     _objUnderTest = new MedianOfTwoSortedArrays();
 }
Пример #10
0
        public void DataDrivenTest(int[] nums1, int[] nums2, int expectedMedian)
        {
            var sut = new MedianOfTwoSortedArrays();

            double median = sut.FindMedianSortedArrays(nums1, nums2);
        }