Fix bad serials (#304)

- [X] Fixes bad serial calculations
- [X] Tightens HexStrings

Bumps release version
Updates documentation
This commit is contained in:
Kamron Batman 2020-11-08 12:09:26 -08:00 • committed by GitHub
parent b0c1076cb5
commit ae436cb55f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 76 additions and 51 deletions

View file

@ -1,42 +0,0 @@
using System;
using System.Buffers;
using Server.Network;
using Xunit;
namespace Server.Tests.Network
{
public class LightPacketTests
{
[Fact]
public void TestGlobalLightLevel()
{
byte lightLevel = 5;
var data = new GlobalLightLevel(lightLevel).Compile();
Span<byte> expectedData = stackalloc byte[2];
var pos = 0;
expectedData.Write(ref pos, (byte)0x4F); // Packet ID
expectedData.Write(ref pos, lightLevel);
AssertThat.Equal(data, expectedData);
}
[Fact]
public void TestPersonalLightLevel()
{
Serial serial = 0x1;
byte lightLevel = 5;
var data = new PersonalLightLevel(serial, lightLevel).Compile();
Span<byte> expectedData = stackalloc byte[6];
var pos = 0;
expectedData.Write(ref pos, (byte)0x4E); // Packet ID
expectedData.Write(ref pos, serial);
expectedData.Write(ref pos, lightLevel);
AssertThat.Equal(data, expectedData);
}
}
}