* Give .props files 2-space indents.
* Move to Central Package Management.
Allows us to store NuGet package versions all in one place. Yay!
* Update NuGet packages and fix code for changes.
Notable:
Changes to ILVerify.
Npgsql doesn't need hacks for inet anymore, now we need hacks to make the old code work with this new reality.
NUnit's analyzers are already complaining and I didn't even update it to 4.x yet.
TerraFX changed to GetLastSystemError so error handling had to be changed.
Buncha APIs have more NRT annotations.
* Remove dotnet-eng NuGet package source.
I genuinely don't know what this was for, and Central Package Management starts throwing warnings about it, so YEET.
* Remove Robust.Physics project.
Never used.
* Remove erroneous NVorbis reference.
Should be VorbisPizza and otherwise wasn't used.
* Sandbox fixes
* Remove unused unit test package references.
Castle.Core and NUnit.ConsoleRunner.
* Update NUnit to 4.0.1
This requires replacing all the old assertion methods because they removed them 🥲
* Oh so that's what dotnet-eng was used for. Yeah ok that makes sense.
* Add Robust.Analyzers.Test
* Update submodule
* commit to re-run CI
61 lines
1.5 KiB
C#
61 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Content.Shared;
|
|
using NUnit.Framework;
|
|
using Robust.Shared.Maths;
|
|
using Robust.UnitTesting;
|
|
|
|
namespace Content.Tests.Shared;
|
|
|
|
[TestFixture]
|
|
public sealed class DirectionRandomizerTest : RobustUnitTest
|
|
{
|
|
[Test]
|
|
[TestCase(new[]
|
|
{
|
|
Direction.East,
|
|
Direction.NorthEast,
|
|
Direction.West,
|
|
Direction.NorthWest,
|
|
Direction.South,
|
|
Direction.SouthWest,
|
|
Direction.North,
|
|
Direction.SouthEast,
|
|
})]
|
|
[TestCase(new[]
|
|
{
|
|
Direction.East,
|
|
Direction.West,
|
|
Direction.South,
|
|
Direction.North,
|
|
})]
|
|
[TestCase(new[]
|
|
{
|
|
Direction.East,
|
|
Direction.West,
|
|
})]
|
|
public void TestRandomization(Direction[] x)
|
|
{
|
|
var set = new HashSet<Direction>(x);
|
|
var randomizer = new Span<Direction>(x);
|
|
randomizer.Shuffle();
|
|
foreach (var direction in randomizer)
|
|
{
|
|
if (set.Contains(direction))
|
|
{
|
|
set.Remove(direction);
|
|
}
|
|
else
|
|
{
|
|
// Asserts no double direction
|
|
Assert.Fail("Post randomization the enumerator had repeated direction");
|
|
}
|
|
}
|
|
// Because of above foreach this asserts
|
|
// rand[1,2,3] - [1,2,3] == {}
|
|
// i.e. randomized set minus original set is empty
|
|
Assert.That(set.Count == 0, "Each element must appear once ");
|
|
|
|
}
|
|
}
|