Exemple #1
0
        public void TestSortListOfChar()
        {
            var sortingAlgorithm = new InsertionSortAlgorithm();

            var result = sortingAlgorithm.Sort <char>(_charLists, _cancellationToken, _progress);

            Assert.AreEqual('a', result[0]);
            Assert.AreEqual('b', result[1]);
            Assert.AreEqual('b', result[2]);
            Assert.AreEqual('z', result[3]);
        }
Exemple #2
0
        public void TestSortListOfString()
        {
            var sortingAlgorithm = new InsertionSortAlgorithm();

            var result = sortingAlgorithm.Sort <string>(_stringList, _cancellationToken, _progress);

            Assert.AreEqual("Four", result[0]);
            Assert.AreEqual("One", result[1]);
            Assert.AreEqual("Three", result[2]);
            Assert.AreEqual("Two", result[3]);
        }
Exemple #3
0
        public void TestSortListOfInt()
        {
            var sortingAlgorithm = new InsertionSortAlgorithm();

            var result = sortingAlgorithm.Sort <int>(_intLists, _cancellationToken, _progress);

            Assert.AreEqual(-1, result[0]);
            Assert.AreEqual(0, result[1]);
            Assert.AreEqual(1, result[2]);
            Assert.AreEqual(5, result[3]);
            Assert.AreEqual(10, result[4]);
            Assert.AreEqual(10, result[5]);
        }