tests first: repeated messageId key, each runtime's declared policy (C# failing)
Vectors admittedMessageIdDuplicates carry [invalid,valid], [valid,invalid], [valid,valid]. Decoders that see the duplicate (C#, Rust) must refuse all three; map-collapsing decoders (Python, TS, Kotlin) judge the last key. Python, TS, Kotlin and Rust already behave as declared; C# fails: it accepted [valid,valid]. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
a97861945c
commit
cc5a9cec9b
6 changed files with 94 additions and 2 deletions
|
|
@ -87,5 +87,19 @@ namespace GameCult.Networking.Tests
|
|||
if (Accepted("a" + char.ConvertFromUtf32(point)) != want) failures.Add($"a + U+{point:X} should be {(want ? "accepted" : "refused")}");
|
||||
Assert.That(failures, Is.Empty);
|
||||
}
|
||||
|
||||
// admittedMessageIdDuplicates: C# reads the raw map, so it sees a repeated messageId key and refuses it whatever the values.
|
||||
[Test]
|
||||
public void ARepeatedMessageIdKeyIsRefusedWhateverTheValues()
|
||||
{
|
||||
var cases = Vectors().GetProperty("admittedMessageIdDuplicates").GetProperty("cases").EnumerateArray().ToArray();
|
||||
Assert.That(cases.Length, Is.EqualTo(Vectors().GetProperty("counts").GetProperty("admittedMessageIdDuplicateCases").GetInt32()));
|
||||
foreach (var vector in cases)
|
||||
{
|
||||
Assert.That(vector.GetProperty("seesDuplicate").GetString(), Is.EqualTo("refuse"));
|
||||
Assert.That(() => CultNetSchemaMessageSerialization.Deserialize(Convert.FromHexString(vector.GetProperty("wireHex").GetString()!)),
|
||||
Throws.Exception, vector.GetProperty("name").GetString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue