mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-21 00:29:29 +00:00
Removed comparators in favor of IComparable implementation
This commit is contained in:
@@ -11,26 +11,11 @@ namespace SystemExtensions.Collections.Tests
|
||||
[TestClass()]
|
||||
public class AVLTreeTests
|
||||
{
|
||||
private static int IntegerComparison(int x, int y)
|
||||
{
|
||||
if (x == y)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (x > y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
private AVLTree<int> avlTree = new AVLTree<int>(new Comparison<int>(IntegerComparison));
|
||||
private AVLTree<int> avlTree = new AVLTree<int>();
|
||||
[TestMethod()]
|
||||
public void AVLTreeTest()
|
||||
{
|
||||
avlTree = new AVLTree<int>(IntegerComparison);
|
||||
avlTree = new AVLTree<int>();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
|
||||
@@ -12,32 +12,17 @@ namespace SystemExtensions.Collections.Tests
|
||||
[TestClass()]
|
||||
public class BinaryHeapTests
|
||||
{
|
||||
private static int IntegerComparison(int x, int y)
|
||||
{
|
||||
if (x == y)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (x > y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
private BinaryHeap<int> binaryHeap = new BinaryHeap<int>(new Comparison<int>(IntegerComparison));
|
||||
private BinaryHeap<int> binaryHeap = new BinaryHeap<int>();
|
||||
[TestMethod()]
|
||||
public void BinaryHeapTest()
|
||||
{
|
||||
binaryHeap = new BinaryHeap<int>(new Comparison<int>(IntegerComparison));
|
||||
binaryHeap = new BinaryHeap<int>();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
public void BinaryHeapTest1()
|
||||
{
|
||||
binaryHeap = new BinaryHeap<int>(new Comparison<int>(IntegerComparison), 100);
|
||||
binaryHeap = new BinaryHeap<int>(100);
|
||||
if (binaryHeap.Count != 0 && binaryHeap.Capacity != 100)
|
||||
{
|
||||
Assert.Fail();
|
||||
|
||||
@@ -12,22 +12,7 @@ namespace SystemExtensions.Collections.Tests
|
||||
[TestClass()]
|
||||
public class FibonacciHeapTests
|
||||
{
|
||||
private static int IntegerComparison(int x, int y)
|
||||
{
|
||||
if (x == y)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (x > y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
FibonacciHeap<int> fibonacciHeap = new FibonacciHeap<int>(new Comparison<int>(IntegerComparison));
|
||||
FibonacciHeap<int> fibonacciHeap = new FibonacciHeap<int>();
|
||||
[TestMethod()]
|
||||
public void InsertTest()
|
||||
{
|
||||
@@ -40,7 +25,7 @@ namespace SystemExtensions.Collections.Tests
|
||||
[TestMethod()]
|
||||
public void FibonacciHeapTest()
|
||||
{
|
||||
fibonacciHeap = new FibonacciHeap<int>(new Comparison<int>(IntegerComparison));
|
||||
fibonacciHeap = new FibonacciHeap<int>();
|
||||
if(fibonacciHeap.Count != 0)
|
||||
{
|
||||
Assert.Fail();
|
||||
@@ -50,8 +35,8 @@ namespace SystemExtensions.Collections.Tests
|
||||
[TestMethod()]
|
||||
public void MergeTest()
|
||||
{
|
||||
FibonacciHeap<int> fibonacciHeap1 = new FibonacciHeap<int>(new Comparison<int>(IntegerComparison));
|
||||
FibonacciHeap<int> fibonacciHeap2 = new FibonacciHeap<int>(new Comparison<int>(IntegerComparison));
|
||||
FibonacciHeap<int> fibonacciHeap1 = new FibonacciHeap<int>();
|
||||
FibonacciHeap<int> fibonacciHeap2 = new FibonacciHeap<int>();
|
||||
|
||||
for(int i = 0; i < 100; i++)
|
||||
{
|
||||
|
||||
@@ -12,28 +12,13 @@ namespace SystemExtensions.Collections.Tests
|
||||
[TestClass()]
|
||||
public class PriorityQueueTests
|
||||
{
|
||||
private static int IntegerComparison(int x, int y)
|
||||
{
|
||||
if (x == y)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (x > y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
private PriorityQueue<int> priorityQueue = new PriorityQueue<int>(new Comparison<int>(IntegerComparison));
|
||||
private PriorityQueue<int> priorityQueue = new PriorityQueue<int>();
|
||||
[TestMethod()]
|
||||
public void PriorityQueueTest()
|
||||
{
|
||||
try
|
||||
{
|
||||
priorityQueue = new PriorityQueue<int>(new Comparison<int>(IntegerComparison));
|
||||
priorityQueue = new PriorityQueue<int>();
|
||||
if(priorityQueue.Count > 0)
|
||||
{
|
||||
Assert.Fail();
|
||||
|
||||
@@ -11,26 +11,11 @@ namespace SystemExtensions.Collections.Tests
|
||||
[TestClass()]
|
||||
public class TreapTests
|
||||
{
|
||||
private static int IntegerComparison(int x, int y)
|
||||
{
|
||||
if (x == y)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (x > y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
Treap<int> treap = new Treap<int>(new Comparison<int>(IntegerComparison));
|
||||
Treap<int> treap = new Treap<int>();
|
||||
[TestMethod()]
|
||||
public void TreapTest()
|
||||
{
|
||||
treap = new Treap<int>(new Comparison<int>(IntegerComparison));
|
||||
treap = new Treap<int>();
|
||||
}
|
||||
|
||||
[TestMethod()]
|
||||
|
||||
Reference in New Issue
Block a user