예제 #1
0
        public void Test(int[][] array, int[] result)
        {
            var text = $"{Int2dToString(array)}\nshould be sorted to\n[{string.Join(",", result)}]\n";

            Console.WriteLine(text);
            Assert.AreEqual(result, SnailSort.Snail(array));
        }
예제 #2
0
 public void EmptyMatrix()
 {
     Assert.Equal(new int[0], SnailSort.Snail(new int[][] { new int[0] }));
 }
예제 #3
0
 public void SizeFourMatrix()
 {
     Assert.Equal(new int[] { 1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10 }, SnailSort.Snail(new int[][] { new int[] { 1, 2, 3, 4 }, new int[] { 5, 6, 7, 8 }, new int[] { 9, 10, 11, 12 }, new int[] { 13, 14, 15, 16 } }));
 }
예제 #4
0
 public void SizeThreeMatrix()
 {
     Assert.Equal(new int[] { 1, 2, 3, 6, 9, 8, 7, 4, 5 }, SnailSort.Snail(new int[][] { new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 }, new int[] { 7, 8, 9 } }));
 }
예제 #5
0
 public void SizeTwoMatrix()
 {
     Assert.Equal(new int[] { 1, 2, 4, 3 }, SnailSort.Snail(new int[][] { new int[] { 1, 2 }, new int[] { 3, 4 } }));
 }
예제 #6
0
 public void SizeOneMatrix()
 {
     Assert.Equal(new int[] { 1 }, SnailSort.Snail(new int[][] { new int[] { 1 } }));
 }