Пример #1
0
        public void SortBy1()
        {
            var list     = FList.New(7, 1, 4, 6, 3, 2, 5);
            var actual   = FList.SortBy((x, y) => x < y, list);
            var expected = FList.New(1, 2, 3, 4, 5, 6, 7);

            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void SortBy7() //Test for stability
        {
            var list     = FList.New("Adi", "Ali", "Amy", "Max", "Zoe");
            var actual   = FList.SortBy((x, y) => x[0] < y[0], list);
            var expected = FList.New("Adi", "Ali", "Amy", "Max", "Zoe");

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void SortBy6()
        {
            var list     = FList.New("Zoe", "Amy", "Ali", "Max", "Adi");
            var actual   = FList.SortBy((x, y) => x[0] <= y[0], list);
            var expected = FList.New("Adi", "Ali", "Amy", "Max", "Zoe");

            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void SortBy5()
        {
            var list     = FList.Empty <int>();
            var actual   = FList.SortBy((x, y) => x < y, list);
            var expected = FList.Empty <int>();

            Assert.AreEqual(expected, actual);
        }
Пример #5
0
        public void SortBy4()
        {
            var list     = FList.New(3);
            var actual   = FList.SortBy((x, y) => x < y, list);
            var expected = FList.New(3);

            Assert.AreEqual(expected, actual);
        }
Пример #6
0
        public void SortBy1String()
        {
            var list     = "EBcCbF";
            var actual   = FList.SortBy((x, y) => x < y, list);
            var expected = "BCEFbc";

            Assert.AreEqual(expected, actual.ToString());
        }