mirror of
https://github.com/modernuo/ModernUO
synced 2026-08-11 22:23:06 -04:00
> [!CAUTION] > **BREAKING CHANGE** > Removed `OrderdHashSet` and `PooledOrderedHashSet` due to bugs. > [!NOTE] > **Developer Note** > The OrderedSet is not a full data structure. It is not particularly efficient. Pull Requests are welcome for a better implementation, especially if it ends up supporting `ISet<T>` and `IReadOnlySet<T>` ## Summary The ordered hash set was buggy. It's kind of painful to implement, so for now, I added a simple `OrderedSet` to suffice for gumps. Please reach out if this causes disruption!
29 lines
602 B
C#
29 lines
602 B
C#
using Server.Collections;
|
|
using Xunit;
|
|
|
|
namespace Server.Tests;
|
|
|
|
public class OrderedSetTests
|
|
{
|
|
[Fact]
|
|
public void TestOrderedSet()
|
|
{
|
|
int[] expected = [6, 2, 4, 23, 0];
|
|
var set = new OrderedSet<int>();
|
|
for (var i = 0; i < expected.Length; i++)
|
|
{
|
|
set.Add(expected[i]);
|
|
}
|
|
|
|
Assert.Equal(expected.Length, set.Count);
|
|
|
|
Assert.True(set.Contains(4));
|
|
Assert.False(set.Contains(8));
|
|
|
|
int index = 0;
|
|
foreach (var value in set)
|
|
{
|
|
Assert.Equal(expected[index++], value);
|
|
}
|
|
}
|
|
}
|