Wire: write doubles and floats with .NET Framework's round-trip digits
The original ran Newtonsoft.Json on .NET Framework, whose "R" format writes 15 significant digits when they read back exactly and 17 otherwise (floats: 7, else 9). Modern .NET writes the shortest round trip instead, so a value like -0.066666670143604279 came out as -0.06666667014360428: equal when parsed, different bytes. Every frame now goes through a converter that repeats the Framework rule, with Newtonsoft's '.0' suffix and non-finite handling kept. Goldens that encoded the modern digits are corrected. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
82a518dcfb
commit
5a94e1cf0b
7 changed files with 148 additions and 7 deletions
|
|
@ -36,7 +36,7 @@ public sealed class StreamGoldenTests
|
|||
true);
|
||||
}
|
||||
|
||||
private static string D(float value) => ((double)value).ToString("R", CultureInfo.InvariantCulture);
|
||||
private static string D(float value) => OpenAC.MosswartMassacre.Backend.FrameworkNumberConverter.FrameworkRoundTrip((double)value);
|
||||
|
||||
private static PluginHarness LoggedIn(Action<PluginHarness>? arrange = null)
|
||||
{
|
||||
|
|
@ -130,7 +130,7 @@ public sealed class StreamGoldenTests
|
|||
harness.Context.Settings.Current.CharTag = "tank";
|
||||
harness.Clock.Advance(TimeSpan.FromMinutes(90));
|
||||
|
||||
string json = Newtonsoft.Json.JsonConvert.SerializeObject(harness.Feature<TelemetryStream>().Build());
|
||||
string json = OpenAC.MosswartMassacre.Backend.Wire.Serialize(harness.Feature<TelemetryStream>().Build());
|
||||
var frame = Newtonsoft.Json.Linq.JObject.Parse(json);
|
||||
|
||||
string[] expectedOrder =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue