Exemple #1
0
 public void SimpleTest4()
 {
     Assert.AreEqual(
         "-3--1,2,10,15,16,18-20",
         RangeExtraction.Extract(new[] { -3, -2, -1, 2, 10, 15, 16, 18, 19, 20 })
         );
 }
Exemple #2
0
 public void SimpleTest3()
 {
     Assert.AreEqual(
         "-6,-3-1,3-5,7-11,14,15,17-20",
         RangeExtraction.Extract(new[] { -6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20 })
         );
 }
Exemple #3
0
        public void SimpleTests()
        {
            Assert.AreEqual("1,2", RangeExtraction.Extract(new[] { 1, 2 }));
            Assert.AreEqual("1-3", RangeExtraction.Extract(new[] { 1, 2, 3 }));

            Assert.AreEqual(
                "-6,-3-1,3-5,7-11,14,15,17-20",
                RangeExtraction.Extract(new[] { -6, -3, -2, -1, 0, 1, 3, 4, 5, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 20 })
                );

            Assert.AreEqual(
                "-3--1,2,10,15,16,18-20",
                RangeExtraction.Extract(new[] { -3, -2, -1, 2, 10, 15, 16, 18, 19, 20 })
                );
        }
Exemple #4
0
 public void ExtractTest(int[] input, string output)
 {
     Assert.Equal(output, RangeExtraction.Extract(input));
 }
Exemple #5
0
 public void SimpleTest1()
 {
     Assert.AreEqual("1,2", RangeExtraction.Extract(new[] { 1, 2 }));
 }
Exemple #6
0
 public void SimpleTest2()
 {
     Assert.AreEqual("1-3", RangeExtraction.Extract(new[] { 1, 2, 3 }));
 }
Exemple #7
0
 public void ShouldReturnTheCorrectlyExtractedRangeFromNumbers(int[] numbers, string expected)
 {
     Assert.Equal(expected, RangeExtraction.Extract(numbers));
 }