示例#1
0
        public void SmokeTest()
        {
            var toSort = new string[]
            {
                "atari",
                "apple",
                "faceb",
                "googl",
                "walma",
                "amazo",
                "netfl",
                "micro",
                "linke",
            };

            Lsd.Sort(toSort);

            Assert.AreEqual("amazo", toSort[0]);
            Assert.AreEqual("apple", toSort[1]);
            Assert.AreEqual("atari", toSort[2]);
            Assert.AreEqual("faceb", toSort[3]);
            Assert.AreEqual("googl", toSort[4]);
            Assert.AreEqual("linke", toSort[5]);
            Assert.AreEqual("micro", toSort[6]);
            Assert.AreEqual("netfl", toSort[7]);
            Assert.AreEqual("walma", toSort[8]);
        }
示例#2
0
        public void LsdSortTest()
        {
            var a = new string[] {
                "4PGC938",
                "2IYE230",
                "3CIO720",
                "1ICK750",
                "1OHV845",
                "4JZY524",
                "1ICK750",
                "3CIO720",
                "1OHV845",
                "1OHV845",
                "2RLA629",
                "2RLA629",
                "3ATW723",
            };

            var b = new string[] {
                "1ICK750",
                "1ICK750",
                "1OHV845",
                "1OHV845",
                "1OHV845",
                "2IYE230",
                "2RLA629",
                "2RLA629",
                "3ATW723",
                "3CIO720",
                "3CIO720",
                "4JZY524",
                "4PGC938",
            };

            Lsd.Sort(a, a[0].Length);
            for (int i = 0; i < a.Length; i++)
            {
                Assert.Equal(a[i], b[i]);
            }
        }
示例#3
0
文件: LSDTests.cs 项目: arst/AandDS
        public void Baseline()
        {
            var sut = new Lsd();

            var input = new[]
            {
                "4PGC938",
                "2IYE230",
                "3CIO720",
                "1ICK750",
                "1OHV845",
                "4JZY524",
                "1ICK750",
                "3CIO720",
                "1OHV845",
                "1OHV845",
                "2RLA629",
                "2RLA629",
                "3ATW723"
            };

            Assert.Collection(sut.Sort(input, 6),
                              arg => Assert.Equal("1ICK750", arg),
                              arg => Assert.Equal("1ICK750", arg),
                              arg => Assert.Equal("1OHV845", arg),
                              arg => Assert.Equal("1OHV845", arg),
                              arg => Assert.Equal("1OHV845", arg),
                              arg => Assert.Equal("2IYE230", arg),
                              arg => Assert.Equal("2RLA629", arg),
                              arg => Assert.Equal("2RLA629", arg),
                              arg => Assert.Equal("3ATW723", arg),
                              arg => Assert.Equal("3CIO720", arg),
                              arg => Assert.Equal("3CIO720", arg),
                              arg => Assert.Equal("4JZY524", arg),
                              arg => Assert.Equal("4PGC938", arg));
        }