Files
RobustToolbox/Robust.UnitTesting/Shared/Toolshed/ToolshedParserTest.Core.cs
909fd326a0 Toolshed part 2 (#4256)
* Save work.

* three billion tweaks

* Rune-aware parser.

* a

* all shedded out for the night

* a

* oogh

* Publicizes a lot of common generic commands, so custom toolshed envs can include them.

* Implement parsing for all number types.

* i think i might implode

* a

* Tests.

* a

* Enum parser test.

* do u like parsers

* oopls

* ug fixes

* Toolshed is approaching a non-insignificant part of the engine's size.

* Pool toolshed's tests, also type tests.

* bwa

* tests pass :yay:

* Update Robust.Shared/CVars.cs

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>

* how did this not fail tests

* awa

* many levels of silly

---------

Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
2023-08-23 16:03:34 -05:00

87 lines
3.1 KiB
C#

using System;
using System.Numerics;
using System.Threading.Tasks;
using NUnit.Framework;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Toolshed.Syntax;
using Robust.Shared.Utility;
namespace Robust.UnitTesting.Shared.Toolshed;
public sealed partial class ToolshedParserTest
{
[Test]
public async Task AllCoreTypesParseable()
{
await Server.WaitAssertion(() =>
{
Assert.Multiple(() =>
{
// Integer types.
AssertParseable<byte>();
AssertParseable<sbyte>();
AssertParseable<short>();
AssertParseable<ushort>();
AssertParseable<int>();
AssertParseable<uint>();
AssertParseable<long>();
AssertParseable<ulong>();
AssertParseable<nint>();
AssertParseable<nuint>();
AssertParseable<BigInteger>();
AssertParseable<decimal>();
AssertParseable<Half>();
// Common
AssertParseable<bool>();
AssertParseable<string>();
AssertParseable<EntityUid>();
AssertParseable<ResPath>();
AssertParseable<Type>();
AssertParseable<TestEnum>();
// maff
AssertParseable<Vector2>();
AssertParseable<Vector2i>();
AssertParseable<Robust.Shared.Maths.Vector3>();
AssertParseable<Robust.Shared.Maths.Vector4>();
AssertParseable<Box2>();
AssertParseable<Box2i>();
AssertParseable<Angle>();
AssertParseable<Color>();
AssertParseable<Direction>();
AssertParseable<DirectionFlag>();
AssertParseable<UIBox2>();
AssertParseable<UIBox2i>();
// The tuples. *scream
AssertParseable<ValueTuple<int, int>>();
AssertParseable<ValueTuple<int, int, int>>();
AssertParseable<ValueTuple<int, int, int, int>>();
AssertParseable<ValueTuple<int, int, int, int, int>>();
AssertParseable<ValueTuple<int, int, int, int, int, int>>();
AssertParseable<ValueTuple<int, int, int, int, int, int, int>>();
// this line literally breaks rider, uncomment when it doesn't.
//AssertParseable<ValueTuple<int, int, int, int, int, int, int, ValueTuple>>();
// Toolshed special constructs.
AssertParseable<ValueRef<object>>();
AssertParseable<ValueRef<object, object>>();
AssertParseable<CommandRun>();
AssertParseable<CommandRun<object>>();
AssertParseable<CommandRun<object, object>>();
AssertParseable<Block>();
AssertParseable<Block<object>>();
AssertParseable<Block<object, object>>();
});
});
}
private enum TestEnum
{
A = 0,
B = 1
}
}