using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using NumberExtensions.Collections;
namespace TestExtensions
{
public partial class Number
{
[Test]
public void TEST_INTEGER_SORT_STRATEGIES()
{
IEnumerable<int> integerList = new List<int> { 1, 2, 20, 3, 6, 20 };
IEnumerable<int> sortedList = new List<int> { 1, 2, 3, 6, 20, 20 };
Assert.AreEqual(sortedList, integerList.Sort(SortMethod.Bubble));
Assert.AreEqual(sortedList, integerList.Sort(SortMethod.Insertion));
Assert.AreEqual(sortedList, integerList.Sort(SortMethod.Selection));
}
[Test]
public void TEST_LONG_SORT_STRATEGIES()
{
IEnumerable<long> longList = new List<long> { 1, 2, 20, 3, 6, 20 };
IEnumerable<long> sortedList = new List<long> { 1, 2, 3, 6, 20, 20 };
Assert.AreEqual(sortedList, longList.Sort(SortMethod.Bubble));
Assert.AreEqual(sortedList, longList.Sort(SortMethod.Insertion));
Assert.AreEqual(sortedList, longList.Sort(SortMethod.Selection));
}
[Test]
public void TEST_DOUBLE_SORT_STRATEGIES()
{
IEnumerable<double> doubleList = new List<double> { 1.1, 2.0, 20.3, 3.5, 6.2, 20.3, 20.3 };
IEnumerable<double> sortedList = new List<double> { 1.1, 2.0, 3.5, 6.2, 20.3, 20.3, 20.3 };
Assert.AreEqual(sortedList, doubleList.Sort(SortMethod.Bubble));
Assert.AreEqual(sortedList, doubleList.Sort(SortMethod.Insertion));
Assert.AreEqual(sortedList, doubleList.Sort(SortMethod.Selection));
}
[Test]
public void TEST_FLOAT_SORT_STRATEGIES()
{
IEnumerable<float> floatList = new List<float> { 1, 2, 2, 3, 6, 2, 3 };
IEnumerable<float> sortedList = new List<float> { 1, 2, 2, 2, 3, 3, 6 };
Assert.AreEqual(sortedList, floatList.Sort(SortMethod.Bubble));
Assert.AreEqual(sortedList, floatList.Sort(SortMethod.Insertion));
Assert.AreEqual(sortedList, floatList.Sort(SortMethod.Selection));
}
[Test]
public void TEST_DECIMAL_SORT_STRATEGIES()
{
IEnumerable<decimal> decimalList = new List<decimal> { 1, 2, 2, 3, 6, 2 };
IEnumerable<decimal> sortedList = new List<decimal> { 1, 2, 2, 2, 3, 6 };
Assert.AreEqual(sortedList, decimalList.Sort(SortMethod.Bubble));
Assert.AreEqual(sortedList, decimalList.Sort(SortMethod.Insertion));
Assert.AreEqual(sortedList, decimalList.Sort(SortMethod.Selection));
}
}
}