﻿using AlgorithmSandbox.Chapter10;
using Xunit;

namespace AlgorithmSandbox.Tests.Chapter10
{
    public class Question1Tests
    {
        [Fact]
        public void Test1()
        {
            var a = new[] {0, 1, 2, 3, 4, 5, 0, 0, 0, 0};
            var b = new[] {0, 1, 6, 7};
            var expected = new[] { 0, 0, 1, 1, 2, 3, 4, 5, 6, 7 };
            Assert.Equal(expected, Question1.Merge(a, b, 6));
        }

        [Fact]
        public void TestV2()
        {
            var a = new[] {0, 1, 2, 3, 4, 5, 0, 0, 0, 0};
            var b = new[] {0, 1, 6, 7};
            var expected = new[] { 0, 0, 1, 1, 2, 3, 4, 5, 6, 7 };
            Assert.Equal(expected, Question1.MergeV2(a, b, 6));
        }

        [Fact]
        public void TestV3()
        {
            var a = new[] {0, 1, 2, 3, 4, 5, 0, 0, 0, 0};
            var b = new[] {0, 1, 6, 7};
            var expected = new[] { 0, 0, 1, 1, 2, 3, 4, 5, 6, 7 };
            Assert.Equal(expected, Question1.MergeV3(a, b, 6));
        }
    }
}