test: remove trivial, duplicate and content-value tests (#2721)

## 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.
This commit is contained in:
Kamron Batman 2026-10-18 20:08:19 -07:00 • committed by GitHub
parent 078be52777
commit 9a25054809
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
89 changed files with 11 additions and 4603 deletions

View file

@ -7,14 +7,6 @@ namespace UOContent.Tests;
public class BitMask256Tests
{
[Fact]
public void BitMask256_InitialState_AllBitsZero()
{
var mask = BitMask256.AllClear();
Assert.Equal(0, mask.PopCount());
}
[Theory]
[InlineData(0)]
[InlineData(63)]
@ -110,41 +102,6 @@ public class SectorSpawnCacheManagerTests
SectorSpawnCacheManager.ClearAll();
}
[Fact]
public void ClearAll_ResetsCache()
{
SectorSpawnCacheManager.ClearAll();
Assert.Equal(0, SectorSpawnCacheManager.CachedSectorCount);
Assert.Equal(0, SectorSpawnCacheManager.LandCacheCount);
Assert.Equal(0, SectorSpawnCacheManager.WaterCacheCount);
}
[Fact]
public void SetValid_CreatesSectorCache()
{
var map = Map.Felucca;
var pos = new Point3D(100, 100, 0);
SectorSpawnCacheManager.SetValid(map, pos, isWater: false);
Assert.Equal(1, SectorSpawnCacheManager.CachedSectorCount);
Assert.Equal(1, SectorSpawnCacheManager.LandCacheCount);
Assert.Equal(0, SectorSpawnCacheManager.WaterCacheCount);
}
[Fact]
public void SetValid_Water_CreatesWaterCache()
{
var map = Map.Felucca;
var pos = new Point3D(100, 100, 0);
SectorSpawnCacheManager.SetValid(map, pos, isWater: true);
Assert.Equal(1, SectorSpawnCacheManager.CachedSectorCount);
Assert.Equal(0, SectorSpawnCacheManager.LandCacheCount);
Assert.Equal(1, SectorSpawnCacheManager.WaterCacheCount);
}
[Fact]
public void SetValid_LandAndWater_SeparateCaches()
{
@ -251,19 +208,6 @@ public class SectorSpawnCacheManagerTests
Assert.False(result);
}
[Fact]
public void InvalidateSectors_RemovesCachedData()
{
var map = Map.Felucca;
SectorSpawnCacheManager.SetValid(map, new Point3D(50, 50, 0), isWater: false);
Assert.Equal(1, SectorSpawnCacheManager.CachedSectorCount);
SectorSpawnCacheManager.InvalidateSectors(map, new Rectangle2D(0, 0, 100, 100));
Assert.Equal(0, SectorSpawnCacheManager.CachedSectorCount);
}
[Fact]
public void InvalidateSectors_RemovesBothLandAndWater()
{
@ -341,54 +285,6 @@ public class SpiralScanTests
Assert.Equal(expectedDy, dy);
}
[Fact]
public void SpiralPattern_Ring1Has8Positions()
{
// Ring N has 8*N positions
const int ring1Positions = 1 * 8;
Assert.Equal(8, ring1Positions);
}
[Fact]
public void SpiralPattern_Ring2Has16Positions()
{
const int ring2Positions = 2 * 8;
Assert.Equal(16, ring2Positions);
}
[Fact]
public void SpiralPattern_Ring10Has80Positions()
{
const int ring10Positions = 10 * 8;
Assert.Equal(80, ring10Positions);
}
[Fact]
public void SpiralPattern_Ring1_CoversAllAdjacentTiles()
{
// Ring 1 should cover all 8 adjacent tiles
var expectedOffsets = new HashSet<(int dx, int dy)>
{
(-1, -1), (0, -1), (1, -1), // Top row
(1, 0), // Right
(1, 1), (0, 1), (-1, 1), // Bottom row
(-1, 0) // Left
};
var actualOffsets = new HashSet<(int dx, int dy)>();
for (var position = 0; position < 8; position++)
{
actualOffsets.Add(SectorSpawnCacheManager.GetSpiralOffset(1, position));
}
Assert.Equal(expectedOffsets.Count, actualOffsets.Count);
foreach (var expected in expectedOffsets)
{
Assert.Contains(expected, actualOffsets);
}
}
[Fact]
public void SpiralPattern_Ring2_CoversAllExpectedTiles()
{
@ -414,16 +310,6 @@ public class SpiralScanTests
public class SpawnPositionStateTests
{
[Fact]
public void SpawnPositionState_InitialState_ZeroCounts()
{
var state = new SpawnPositionState();
Assert.False(state.SpiralComplete);
Assert.Equal(0, state.SpiralRing);
Assert.Equal(0, state.SpiralRingPosition);
}
[Fact]
public void Reset_ClearsAllState()
{
@ -457,14 +343,6 @@ public class SpawnPositionStateTests
Assert.False(state.ShouldCachePositions(SpawnPositionMode.Disabled));
}
[Fact]
public void ShouldCachePositions_Automatic_FalseWithNoFailures()
{
var state = new SpawnPositionState();
Assert.False(state.ShouldCachePositions(SpawnPositionMode.Automatic));
}
[Fact]
public void ShouldCachePositions_Automatic_TrueAfterThresholdFailures()
{
@ -522,30 +400,6 @@ public class SpawnPositionStateTests
Assert.True(state.ShouldAbandon());
}
[Fact]
public void ShouldAbandon_FalseWithUsefulCacheHit()
{
var state = new SpawnPositionState();
state.SpiralComplete = true;
// Record 24 useless results
for (var i = 0; i < 24; i++)
{
state.RecordUselessResult();
}
// Record a useful cache hit - resets counter
state.RecordUsefulCacheHit();
// Record a few more useless results
for (var i = 0; i < 5; i++)
{
state.RecordUselessResult();
}
Assert.False(state.ShouldAbandon()); // Counter was reset, only 5 now
}
[Fact]
public void RecordUsefulCacheHit_ResetsUselessCounter()
{