Update DiseaseTest (#9639)

Effects / cures are indices not the threshold
This commit is contained in:
metalgearsloth
2022-07-12 16:15:40 +10:00
committed by GitHub
parent df2e43abfc
commit 9ed9888f86

View File

@@ -23,13 +23,13 @@ public sealed class DiseaseTest
{ {
foreach (var proto in protoManager.EnumeratePrototypes<DiseasePrototype>()) foreach (var proto in protoManager.EnumeratePrototypes<DiseasePrototype>())
{ {
var stages = proto.Stages; var stagesLength = proto.Stages.Count;
foreach (var effect in proto.Effects) foreach (var effect in proto.Effects)
{ {
for (var i = 0; i < effect.Stages.Length; i++) for (var i = 0; i < effect.Stages.Length; i++)
{ {
Assert.That(stages.Contains(i), $"Disease {proto.ID} has an effect with an incorrect stage, {i}!"); Assert.That(i >= 0 && i < stagesLength, $"Disease {proto.ID} has an effect with an incorrect stage, {i}!");
} }
} }
@@ -37,7 +37,7 @@ public sealed class DiseaseTest
{ {
for (var i = 0; i < cure.Stages.Length; i++) for (var i = 0; i < cure.Stages.Length; i++)
{ {
Assert.That(stages.Contains(i), $"Disease {proto.ID} has a cure with an incorrect stage, {i}!"); Assert.That(i >= 0 && i < stagesLength, $"Disease {proto.ID} has a cure with an incorrect stage, {i}!");
} }
} }
} }