From: āda Date: Sun, 21 Sep 2025 14:22:45 +0000 (-0500) Subject: Average min+max in MaterialArbitrageTest (#39578) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=7678251ad58b7182afc66658b9c9b4d8122b1bb3;p=space-station-14.git Average min+max in MaterialArbitrageTest (#39578) * feels too easy * I guess this counts * commit * could have sworn I ran the test --------- Co-authored-by: iaada --- diff --git a/Content.IntegrationTests/Tests/MaterialArbitrageTest.cs b/Content.IntegrationTests/Tests/MaterialArbitrageTest.cs index 3213ccbc43..082baf7e64 100644 --- a/Content.IntegrationTests/Tests/MaterialArbitrageTest.cs +++ b/Content.IntegrationTests/Tests/MaterialArbitrageTest.cs @@ -145,7 +145,7 @@ public sealed class MaterialArbitrageTest Dictionary priceCache = new(); - Dictionary Ents, Dictionary Mats)> spawnedOnDestroy = new(); + Dictionary Ents, Dictionary Mats)> spawnedOnDestroy = new(); // cache the compositions of entities // If the entity is refineable (i.e. glass shared can be turned into glass, we take the greater of the two compositions. @@ -217,8 +217,8 @@ public sealed class MaterialArbitrageTest var comp = (DestructibleComponent) destructible.Component; - var spawnedEnts = new Dictionary(); - var spawnedMats = new Dictionary(); + var spawnedEnts = new Dictionary(); + var spawnedMats = new Dictionary(); // This test just blindly assumes that ALL spawn entity behaviors get triggered. In reality, some entities // might only trigger a subset. If that starts being a problem, this test either needs fixing or needs to @@ -233,14 +233,14 @@ public sealed class MaterialArbitrageTest foreach (var (key, value) in spawn.Spawn) { - spawnedEnts[key] = spawnedEnts.GetValueOrDefault(key) + value.Max; + spawnedEnts[key] = spawnedEnts.GetValueOrDefault(key) + (float)(value.Min + value.Max) / 2; if (!compositions.TryGetValue(key, out var composition)) continue; foreach (var (matId, amount) in composition) { - spawnedMats[matId] = value.Max * amount + spawnedMats.GetValueOrDefault(matId); + spawnedMats[matId] = (float)(value.Min + value.Max) / 2 * amount + spawnedMats.GetValueOrDefault(matId); } } } @@ -451,7 +451,7 @@ public sealed class MaterialArbitrageTest await server.WaitPost(() => mapSystem.DeleteMap(testMap.MapId)); await pair.CleanReturnAsync(); - async Task GetSpawnedPrice(Dictionary ents) + async Task GetSpawnedPrice(Dictionary ents) { double price = 0; foreach (var (id, num) in ents)