Implemented Treap and Treap tests.

This commit is contained in:
Alex Macocian
2019-04-22 14:56:03 +02:00
parent afdfeda826
commit 95f2ab709f
12 changed files with 706 additions and 106 deletions
@@ -22,7 +22,7 @@ namespace SystemExtensions.Threading.Tests
{
threadPool.Dispose();
threadPool = new PriorityThreadPool();
if (threadPool.NumberOfThreads != System.Environment.ProcessorCount / 4)
if (threadPool.NumberOfThreads != System.Environment.ProcessorCount)
{
Assert.Fail();
}
@@ -33,7 +33,7 @@ namespace SystemExtensions.Threading.Tests
{
threadPool.Dispose();
threadPool = new PriorityThreadPool(4);
if (threadPool.NumberOfThreads != 4 / 4)
if (threadPool.NumberOfThreads != 4)
{
Assert.Fail();
}
@@ -102,7 +102,7 @@ namespace SystemExtensions.Threading.Tests
{
threadPool.Dispose();
threadPool = new PriorityThreadPool(4);
if (threadPool.NumberOfThreads != 4 / 4)
if (threadPool.NumberOfThreads != 4)
{
Assert.Fail();
}
@@ -116,13 +116,6 @@ namespace SystemExtensions.Threading.Tests
}
}, null);
}
for (int i = 0; i < 10; i++)
{
System.Diagnostics.Debug.WriteLine("=====================================");
System.Diagnostics.Debug.WriteLine("Current threads in threadpool: " + threadPool.NumberOfThreads);
System.Diagnostics.Debug.WriteLine("=====================================");
Thread.Sleep(100);
}
while (threadPool.NumberOfThreads != 1)
{
System.Diagnostics.Debug.WriteLine("=====================================");
@@ -203,13 +196,6 @@ namespace SystemExtensions.Threading.Tests
System.Diagnostics.Debug.WriteLine(Thread.CurrentThread.ManagedThreadId + " - " + taskPriority);
}, null, taskPriority);
}
for (int i = 0; i < 10; i++)
{
System.Diagnostics.Debug.WriteLine("=====================================");
System.Diagnostics.Debug.WriteLine("Current threads in threadpool: " + threadPool.NumberOfThreads);
System.Diagnostics.Debug.WriteLine("=====================================");
Thread.Sleep(100);
}
while (threadPool.NumberOfThreads != System.Environment.ProcessorCount / 4)
{
System.Diagnostics.Debug.WriteLine("=====================================");