Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions DataStructures.Tests/AATreeTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataStructures.AATree;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests;

Expand Down
11 changes: 3 additions & 8 deletions DataStructures.Tests/AVLTreeTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataStructures.AVLTree;
using FluentAssertions;
using NUnit.Framework;
using static FluentAssertions.FluentActions;

namespace DataStructures.Tests;
Expand Down Expand Up @@ -233,19 +228,19 @@ public void Remove_MultipleKeys_TreeStillValid_Variant2()
tree.GetKeysInOrder()
.Should()
.BeEquivalentTo(
new[] { 4,6,8 },
new[] { 4, 6, 8 },
config => config.WithStrictOrdering());

tree.GetKeysPreOrder()
.Should()
.BeEquivalentTo(
new[] { 6,4,8 },
new[] { 6, 4, 8 },
config => config.WithStrictOrdering());

tree.GetKeysPostOrder()
.Should()
.BeEquivalentTo(
new[] { 4,8,6 },
new[] { 4, 8, 6 },
config => config.WithStrictOrdering());
}

Expand Down
4 changes: 0 additions & 4 deletions DataStructures.Tests/BinarySearchTreeTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataStructures.BinarySearchTree;
using NUnit.Framework;

namespace DataStructures.Tests;

Expand Down
4 changes: 0 additions & 4 deletions DataStructures.Tests/BitArrayTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests;

/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions DataStructures.Tests/Cache/LfuCacheTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using DataStructures.Cache;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.Cache;

Expand Down
2 changes: 0 additions & 2 deletions DataStructures.Tests/Cache/LruCacheTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using DataStructures.Cache;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.Cache;

Expand Down
2 changes: 0 additions & 2 deletions DataStructures.Tests/DisjointSet/DisjointSetTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using DataStructures.DisjointSet;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.DisjointSet;

Expand Down
2 changes: 0 additions & 2 deletions DataStructures.Tests/Fenwick/BinaryIndexedTreeTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using DataStructures.Fenwick;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.Fenwick;

Expand Down
20 changes: 20 additions & 0 deletions DataStructures.Tests/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// -----------------------------------------------------------------------------
// Global using directives for the C-Sharp solution.
// These namespaces are imported globally so they don’t need to be repeatedly declared
// in individual files, improving readability and reducing boilerplate.
//
// Guidelines:
// - Keep only the most commonly used namespaces here.
// - Add project-specific namespaces (e.g., Utilities.Extensions) only if they are
// required across the majority of files in the project.
// - Avoid placing rarely used namespaces here to maintain clarity.
// -----------------------------------------------------------------------------

global using System; // Core base classes and fundamental types
global using System.Collections.Generic; // Generic collection types (List, Dictionary, etc.)
global using System.Linq; // LINQ query operators for collections
global using System.Text; // Text encoding, StringBuilder, etc.
global using NUnit.Framework; // Testing framework providing attributes and assertions for test cases
global using NUnit.Framework.Internal; // Internal NUnit infrastructure (test context, utilities) — generally used for advanced or framework-level test control
global using FluentAssertions; // Assertion library for more readable and expressive unit tests
global using System.Collections; // Non-generic collection types (e.g., ArrayList, Hashtable, IDictionary, ICollection)
5 changes: 0 additions & 5 deletions DataStructures.Tests/Graph/DirectedWeightedGraphTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataStructures.Graph;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.Graph;

Expand Down
13 changes: 5 additions & 8 deletions DataStructures.Tests/Hashing/HashTableTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using DataStructures.Hashing;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.Hashing;

Expand Down Expand Up @@ -275,7 +271,7 @@ public void Keys_ReturnsCorrectKeys()
hashTable.Add(2, "two");
hashTable.Add(3, "three");

var keys = new List<int> { 1,2,3 };
var keys = new List<int> { 1, 2, 3 };

Assert.That(keys, Is.EquivalentTo(hashTable.Keys));
}
Expand Down Expand Up @@ -377,10 +373,11 @@ public void This_Set_KeyNotFoundException_WhenKeyDoesNotExist()
public void This_Get_KeyNotFoundException_WhenKeyDoesNotExist()
{
var hashTable = new HashTable<string, int>(4);
Assert.Throws<KeyNotFoundException>(() => {
Assert.Throws<KeyNotFoundException>(() =>
{
var value = hashTable["one"];
Console.WriteLine(value);
});
});
}

[Test]
Expand Down Expand Up @@ -409,7 +406,7 @@ public void Add_ShouldTriggerResize_WhenThresholdExceeded()
hashTable.Count.Should().Be(4); // Verify count reflects number of added items
}


[Test]
public void Add_ThrowsException_WhenKeyIsDefault()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using DataStructures.Hashing.NumberTheory;
using NUnit.Framework;

namespace DataStructures.Tests.Hashing.NumberTheory;

Expand Down
5 changes: 1 addition & 4 deletions DataStructures.Tests/Heap/BinaryHeapTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using DataStructures.Heap;
using NUnit.Framework;

namespace DataStructures.Tests.Heap;

Expand Down Expand Up @@ -52,7 +49,7 @@ public static void Pop_RemoveElements_HeapStillValid()

Assert.That(heap.Pop(), Is.EqualTo(10));
Assert.That(heap.Count, Is.EqualTo(9));
Assert.That(heap.Contains(10),Is.False);
Assert.That(heap.Contains(10), Is.False);

Assert.That(heap.Pop(), Is.EqualTo(9));
Assert.That(heap.Count, Is.EqualTo(8));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using DataStructures.Heap.FibonacciHeap;
using NUnit.Framework;

namespace DataStructures.Tests.Heap.FibonacciHeaps;

Expand Down Expand Up @@ -41,7 +39,7 @@ public static void Push_AddElements_BuildCorrectHeap()
{
var heap = BuildTestHeap();

Assert.That(heap.Peek(),Is.EqualTo(1));
Assert.That(heap.Peek(), Is.EqualTo(1));
Assert.That(heap.Count, Is.EqualTo(10));
}

Expand Down
4 changes: 0 additions & 4 deletions DataStructures.Tests/Heap/MinMaxHeapTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataStructures.Heap;
using NUnit.Framework;

namespace DataStructures.Tests.Heap;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Collections.Generic;
using DataStructures.Heap.PairingHeap;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.Heap.PairingHeap;

Expand Down
4 changes: 0 additions & 4 deletions DataStructures.Tests/Heap/PairingHeap/PairingHeapTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections;
using System.Linq;
using DataStructures.Heap.PairingHeap;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.Heap.PairingHeap;

Expand Down
4 changes: 0 additions & 4 deletions DataStructures.Tests/InvertedIndexTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
using System.Collections.Generic;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests;

public class InvertedIndexTests
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using DataStructures.LinkedList.CircularLinkedList;
using NUnit.Framework;

namespace DataStructures.Tests.LinkedList;

Expand Down Expand Up @@ -65,7 +63,7 @@ public static void TestInsertAfterInEmptyList()
var cll = new CircularLinkedList<int>();
var ex = Assert.Throws<InvalidOperationException>(() => cll.InsertAfter(10, 20));

Assert.That(ex!.Message, Is.EqualTo("List is empty."));
Assert.That(ex!.Message, Is.EqualTo("List is empty."));
}

[Test]
Expand Down
5 changes: 1 addition & 4 deletions DataStructures.Tests/LinkedList/DoublyLinkedListTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Linq;
using DataStructures.LinkedList.DoublyLinkedList;
using NUnit.Framework;

namespace DataStructures.Tests.LinkedList;

Expand Down Expand Up @@ -65,7 +62,7 @@ public static void TestRemove()
var arr = dll.GetData().ToArray();
var reversedArr = dll.GetDataReversed().ToArray();

Assert.That(dll.Count, Is.EqualTo(2) );
Assert.That(dll.Count, Is.EqualTo(2));
Assert.That(new[] { 1, 3 }, Is.EqualTo(arr));
Assert.That(new[] { 3, 1 }, Is.EqualTo(reversedArr));
}
Expand Down
3 changes: 0 additions & 3 deletions DataStructures.Tests/LinkedList/LinkedListTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Linq;
using DataStructures.LinkedList.SinglyLinkedList;
using NUnit.Framework;

namespace DataStructures.Tests.LinkedList;

Expand Down
6 changes: 1 addition & 5 deletions DataStructures.Tests/LinkedList/SkipListTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using DataStructures.LinkedList.SkipList;
using NUnit.Framework;
using FluentAssertions;
using System.Collections.Generic;

namespace DataStructures.Tests.LinkedList;

Expand Down Expand Up @@ -92,7 +88,7 @@ public static void TestRemove_ItemRemoved()
isRemoved.Should().BeTrue();
}

[Test]
[Test]
public static void TestRemove_ItemNotFound()
{
var list = new SkipList<int>();
Expand Down
5 changes: 0 additions & 5 deletions DataStructures.Tests/Probabilistic/BloomFilterTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataStructures.Probabilistic;
using NUnit.Framework;

namespace DataStructures.Tests.Probabilistic;

Expand Down
6 changes: 1 addition & 5 deletions DataStructures.Tests/Probabilistic/CountMinSketchTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using DataStructures.Probabilistic;
using NUnit.Framework;
using FluentAssertions;

namespace DataStructures.Tests.Probabilistic;

Expand Down Expand Up @@ -61,7 +57,7 @@ public void TestProbabilities()
{
var sketch = new CountMinSketch<int>(.01, .05);
var random = new Random();
var insertedItems = new Dictionary<int,int>();
var insertedItems = new Dictionary<int, int>();
for (var i = 0; i < 10000; i++)
{
var item = random.Next(0, 1000000);
Expand Down
8 changes: 2 additions & 6 deletions DataStructures.Tests/Probabilistic/HyperLogLogTest.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using DataStructures.Probabilistic;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests.Probabilistic;

Expand All @@ -12,7 +8,7 @@ public class HyperLogLogTest
public void TestHyperLogLog()
{
var hll = new HyperLogLog<int>();
HashSet<int> actual = new ();
HashSet<int> actual = new();

var rand = new Random();
var tolerance = .05;
Expand All @@ -36,7 +32,7 @@ public void TestHyperLogLogMerge()
var hll2 = new HyperLogLog<int>();
var rand = new Random();
var tolerance = .05;
HashSet<int> actual = new ();
HashSet<int> actual = new();
for (var i = 0; i < 5000; i++)
{
var k = rand.Next(20000);
Expand Down
3 changes: 0 additions & 3 deletions DataStructures.Tests/Queue/ArrayBasedQueueTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Text;
using DataStructures.Queue;
using NUnit.Framework;

namespace DataStructures.Tests.Queue;

Expand Down
3 changes: 0 additions & 3 deletions DataStructures.Tests/Queue/ListBasedQueueTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Text;
using DataStructures.Queue;
using NUnit.Framework;

namespace DataStructures.Tests.Queue;

Expand Down
3 changes: 0 additions & 3 deletions DataStructures.Tests/Queue/StackBasedQueueTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Text;
using DataStructures.Queue;
using NUnit.Framework;

namespace DataStructures.Tests.Queue;

Expand Down
5 changes: 0 additions & 5 deletions DataStructures.Tests/RedBlackTreeTests.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DataStructures.RedBlackTree;
using FluentAssertions;
using NUnit.Framework;

namespace DataStructures.Tests;

Expand Down
3 changes: 0 additions & 3 deletions DataStructures.Tests/ScapegoatTree/ExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using DataStructures.ScapegoatTree;
using NUnit.Framework;

namespace DataStructures.Tests.ScapegoatTree;

Expand Down
Loading
Loading