Sample outdoor weather from the climate preset so people can freeze and the clock can show it.
Protocol v8 adds tenths of a °C and precipitation to the clock frame; warmth drains from insulation versus place temperature. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -121,7 +121,7 @@ public class ProtocolCodecTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Clock_RoundTripsAndIsTwentyFourBytes()
|
||||
public void Clock_RoundTripsAndIsTwentySevenBytes()
|
||||
{
|
||||
var message = new ServerClockMessage(
|
||||
7,
|
||||
@@ -129,12 +129,14 @@ public class ProtocolCodecTests
|
||||
Running: true,
|
||||
SpeedIndex: 2,
|
||||
SkipAllowed: true,
|
||||
SkipTargetUnixMs: 1_333_516_800_000);
|
||||
SkipTargetUnixMs: 1_333_516_800_000,
|
||||
TemperatureTenths: -50,
|
||||
Precipitation: 2);
|
||||
Span<byte> buffer = stackalloc byte[ProtocolCodec.MaxFrameSize];
|
||||
|
||||
var length = ProtocolCodec.WriteClock(buffer, message);
|
||||
|
||||
Assert.Equal(24, length);
|
||||
Assert.Equal(27, length);
|
||||
Assert.Equal((byte)MessageType.ServerClock, buffer[0]);
|
||||
Assert.Equal(7, BitConverter.ToInt32(buffer[1..5]));
|
||||
Assert.Equal(1_333_432_800_000, BitConverter.ToInt64(buffer[5..13]));
|
||||
@@ -142,6 +144,8 @@ public class ProtocolCodecTests
|
||||
Assert.Equal(2, buffer[14]);
|
||||
Assert.Equal(1, buffer[15]);
|
||||
Assert.Equal(1_333_516_800_000, BitConverter.ToInt64(buffer[16..24]));
|
||||
Assert.Equal(-50, BitConverter.ToInt16(buffer[24..26]));
|
||||
Assert.Equal(2, buffer[26]);
|
||||
Assert.Equal(message, ProtocolCodec.ReadClock(buffer[..length]));
|
||||
}
|
||||
|
||||
@@ -154,9 +158,11 @@ public class ProtocolCodecTests
|
||||
var length = ProtocolCodec.WriteClock(buffer, message);
|
||||
var read = ProtocolCodec.ReadClock(buffer[..length]);
|
||||
|
||||
Assert.Equal(24, length);
|
||||
Assert.Equal(27, length);
|
||||
Assert.False(read.SkipAllowed);
|
||||
Assert.Equal(0, read.SkipTargetUnixMs);
|
||||
Assert.Equal(0, read.TemperatureTenths);
|
||||
Assert.Equal(PrecipitationKind.None, read.Precipitation);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user