## Summary Many tests proved a specific change when it landed but don't need to run on every CI build forever. This removes **202 test methods and 9 files: 313 test cases, 2,247 → 1,934**. UOContent.Tests drops from about 14s to about 5s locally. Removed: - **Tautologies.** Asserting a constant, a constructor readback or a trivial getter, or testing BCL behavior. - **Exact duplicates** of a surviving test on the same code path. - **Obsolete regressions** whose failure can no longer be expressed. - **Game-content values** shard owners customize (era drop rates, loot and skill tables, single-creature tuning). Each customization would otherwise force a test fix. ## How it was decided 1. Every test was classified, with a reason, by a per-shard sweep over all 287 test files. 2. Each proposed deletion was then checked by a second, adversarial reviewer against the surviving tests and the production code. 3. Anything that was the only coverage of a separate code path was **kept**, even where it looked like a duplicate. Examples: the unsigned `SpanReader`/`SpanWriter` methods, the at-location versus bounds enumerators, null-map enumerables, the security filters, archive-journal state transitions. About 130 proposed deletions were rejected this way. Whole files removed: - `FishingTests`, apart from 3 tests: the map-edge scan, serpent cleanup, and SOS chest consumption. The SOS test now stops at the first chest instead of measuring a catch rate. The multi-million-cast rate simulations are gone. - `LordOaksTests` and `MeerEnragedTests` (single-creature tests). - `AutoArchiveHelperTests`, `JsonDiscoverableTypeAttributeTests`, `DecimalSerializationTests` and `EnumConversionTests` (tautologies, or tests of their own local helpers). - `NetworkStatsTests`. - `MigratedDataLoadTests` (a subset of `AllSpawnFilesLoadTests`). - `SpawnerFixtureCapture`: a capture tool, not a test, and its `version == 12` assert can no longer pass. The `.bin` fixtures it produced stay. ## Tests - Server.Tests: 811 pass. - UOContent.Tests: 1,123 pass. A follow-up PR, stacked on this one, fixes how the remaining tests behave: shared state, CI-vacuous tests, harness duplication.
82 lines
2.9 KiB
C#
82 lines
2.9 KiB
C#
using System;
|
|
using Server;
|
|
using Server.Commands;
|
|
using Server.Commands.Generic;
|
|
using Xunit;
|
|
|
|
namespace UOContent.Tests.Commands;
|
|
|
|
// The conditional compiler emits into a fresh dynamic assembly for every command invocation --
|
|
// there is no per-type cache, so `Run` (which can never be unloaded) grows the process by one
|
|
// assembly per `[global where`. And PropertyValue could only load a handful of primitive constant
|
|
// types, so a comparison against anything narrower or unsigned than int threw instead of running.
|
|
public class EmitterRobustnessTests
|
|
{
|
|
public class Subject
|
|
{
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public byte Tiny { get; set; } = 5;
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public sbyte Signed { get; set; } = -5;
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public short Small { get; set; } = -300;
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public ushort Key { get; set; } = 40000;
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public uint Big { get; set; } = 3_000_000_000;
|
|
|
|
[CommandProperty(AccessLevel.GameMaster)]
|
|
public ulong Huge { get; set; } = 18_000_000_000_000_000_000;
|
|
}
|
|
|
|
private static bool Check(string binding, ComparisonOperator op, string value)
|
|
{
|
|
var prop = new Property(binding);
|
|
prop.BindTo(typeof(Subject), PropertyAccess.Read);
|
|
|
|
var compiled = ConditionalCompiler.Compile(
|
|
typeof(Subject),
|
|
[TypeCondition.Default, new ComparisonCondition(prop, false, op, value)]
|
|
);
|
|
|
|
return compiled.Verify(new Subject());
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("Tiny", "5")]
|
|
[InlineData("Signed", "-5")]
|
|
[InlineData("Small", "-300")]
|
|
[InlineData("Key", "40000")]
|
|
[InlineData("Big", "3000000000")]
|
|
[InlineData("Huge", "18000000000000000000")]
|
|
public void NarrowAndUnsignedIntegersCompareByEquality(string binding, string value)
|
|
{
|
|
Assert.True(Check(binding, ComparisonOperator.Equal, value));
|
|
Assert.False(Check(binding, ComparisonOperator.NotEqual, value));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("Tiny", "4")]
|
|
[InlineData("Signed", "-6")]
|
|
[InlineData("Small", "-301")]
|
|
[InlineData("Key", "39999")]
|
|
[InlineData("Big", "2999999999")]
|
|
[InlineData("Huge", "17999999999999999999")]
|
|
public void NarrowAndUnsignedIntegersCompareRelationally(string binding, string value)
|
|
{
|
|
Assert.True(Check(binding, ComparisonOperator.Greater, value));
|
|
Assert.False(Check(binding, ComparisonOperator.Lesser, value));
|
|
}
|
|
|
|
// Unsigned values above the signed range must not wrap into a negative comparison.
|
|
[Fact]
|
|
public void UnsignedComparisonsDoNotWrapThroughSignedMath()
|
|
{
|
|
Assert.True(Check("Big", ComparisonOperator.Greater, "2147483647"));
|
|
Assert.True(Check("Huge", ComparisonOperator.Greater, "9223372036854775807"));
|
|
}
|
|
}
|