1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 04:53:29 +01:00

code cleanup

This commit is contained in:
Ell 2022-10-27 10:22:25 +02:00
parent 8745a3237e
commit 791c66b098
15 changed files with 799 additions and 801 deletions

View file

@ -13,9 +13,6 @@ namespace MLEM.Data {
/// A dynamic enum uses <see cref="BigInteger"/> as its underlying type, allowing for an arbitrary number of enum values to be created, even when a <see cref="FlagsAttribute"/>-like structure is used that would only allow for up to 64 values in a regular enum.
/// All enum operations including <see cref="And{T}"/>, <see cref="Or{T}"/>, <see cref="Xor{T}"/> and <see cref="Neg{T}"/> are supported and can be implemented in derived classes using operator overloads.
/// To create a custom dynamic enum, simply create a class that extends <see cref="DynamicEnum"/>. New values can then be added using <see cref="Add{T}"/>, <see cref="AddValue{T}"/> or <see cref="AddFlag{T}"/>.
///
/// This class, and its entire concept, are extremely terrible. If you intend on using this, there's probably at least one better solution available.
/// Though if, for some weird reason, you need a way to have more than 64 distinct flags, this is a pretty good solution.
/// </summary>
/// <remarks>
/// To include enum-like operator overloads in a dynamic enum named MyEnum, the following code can be used:

View file

@ -11,6 +11,7 @@ using MLEM.Ui.Style;
#if NETSTANDARD2_0_OR_GREATER || NET6_0_OR_GREATER
using System.Net.Http;
#else
using System.Net;
#endif

View file

@ -2,8 +2,9 @@
using MLEM.Cameras;
using NUnit.Framework;
namespace Tests {
public class CameraTests {
namespace Tests;
public class CameraTests {
private TestGame game;
@ -26,5 +27,4 @@ namespace Tests {
Assert.AreEqual(pos, ret);
}
}
}

View file

@ -1,8 +1,9 @@
using MLEM.Extensions;
using NUnit.Framework;
namespace Tests {
public class CollectionTests {
namespace Tests;
public class CollectionTests {
[Test]
public void TestCombinations() {
@ -27,5 +28,4 @@ namespace Tests {
Assert.AreEqual(things.IndexCombinations(), indices);
}
}
}

View file

@ -9,8 +9,9 @@ using Newtonsoft.Json;
using NUnit.Framework;
using Vector2 = Microsoft.Xna.Framework.Vector2;
namespace Tests {
public class DataTests {
namespace Tests;
public class DataTests {
private readonly TestObject testObject = new() {
Vec = new Vector2(10, 20),
@ -82,5 +83,4 @@ namespace Tests {
}
}
}

View file

@ -5,8 +5,9 @@ using MLEM.Data;
using MLEM.Textures;
using NUnit.Framework;
namespace Tests {
public class TestDataTextureAtlas {
namespace Tests;
public class TestDataTextureAtlas {
[Test]
public void Test([Values(0, 4)] int regionX, [Values(0, 4)] int regionY) {
@ -56,5 +57,4 @@ namespace Tests {
Assert.AreEqual("---", data.GetData<string>("DataPoint3"));
}
}
}

View file

@ -2,8 +2,9 @@ using Microsoft.Xna.Framework;
using MLEM.Misc;
using NUnit.Framework;
namespace Tests {
public class DirectionTests {
namespace Tests;
public class DirectionTests {
[Test]
public void TestDirections() {
@ -60,5 +61,4 @@ namespace Tests {
return dir;
}
}
}

View file

@ -8,8 +8,9 @@ using MLEM.Formatting.Codes;
using MLEM.Textures;
using NUnit.Framework;
namespace Tests {
public class FontTests {
namespace Tests;
public class FontTests {
private TestGame game;
private GenericFont font;
@ -153,5 +154,4 @@ namespace Tests {
Assert.AreEqual(new Vector2(0, this.font.LineHeight), this.font.MeasureString(GenericFont.Zwsp.ToString()));
}
}
}

View file

@ -2,8 +2,9 @@
using MLEM.Input;
using NUnit.Framework;
namespace Tests {
public class KeybindTests {
namespace Tests;
public class KeybindTests {
[Test]
public void TestCombinationOrder() {
@ -35,5 +36,4 @@ namespace Tests {
Assert.AreEqual(-1, new Keybind(Keys.A, Keys.LeftAlt).CompareTo(new Keybind(Keys.B, Keys.LeftShift, Keys.RightShift).Add(Keys.B, Keys.RightShift).Add(Keys.C, Keys.RightControl)));
}
}
}

View file

@ -3,8 +3,9 @@ using MLEM.Extensions;
using MLEM.Misc;
using NUnit.Framework;
namespace Tests {
public class NumberTests {
namespace Tests;
public class NumberTests {
[Test]
public void TestRounding() {
@ -67,5 +68,4 @@ namespace Tests {
Assert.AreEqual(penetration, 0);
}
}
}

View file

@ -4,8 +4,9 @@ using Microsoft.Xna.Framework;
using MLEM.Pathfinding;
using NUnit.Framework;
namespace Tests {
public class PathfindingTests {
namespace Tests;
public class PathfindingTests {
[Test]
public void TestConsistency() {
@ -123,5 +124,4 @@ namespace Tests {
return new AStar2((_, p2) => costs[p2.Y][p2.X], allowDiagonals, 1, 64, collectAdditionalNeighbors);
}
}
}

View file

@ -3,8 +3,9 @@ using MLEM.Data.Content;
using MLEM.Font;
using MLEM.Startup;
namespace Tests {
public class TestGame : MlemGame {
namespace Tests;
public class TestGame : MlemGame {
public RawContentManager RawContent { get; private set; }
@ -22,5 +23,4 @@ namespace Tests {
return game;
}
}
}

View file

@ -4,8 +4,9 @@ using MLEM.Data;
using MLEM.Textures;
using NUnit.Framework;
namespace Tests {
public class TexturePackerTests {
namespace Tests;
public class TexturePackerTests {
private Texture2D testTexture;
private Texture2D disposedTestTexture;
@ -105,5 +106,4 @@ namespace Tests {
private static void StubResult(TextureRegion region) {}
}
}

View file

@ -8,8 +8,9 @@ using MLEM.Ui.Elements;
using MLEM.Ui.Style;
using NUnit.Framework;
namespace Tests {
public class UiTests {
namespace Tests;
public class UiTests {
private TestGame game;
@ -146,5 +147,4 @@ namespace Tests {
element.ForceUpdateArea();
}
}
}