fix: remote update failed

This commit is contained in:
2025-05-04 21:56:19 +08:00
parent c6b819f24f
commit 55e363d505
3 changed files with 153 additions and 53 deletions

View File

@@ -1,3 +1,4 @@
using System.Buffers.Binary;
using Common;
namespace server.test;
@@ -45,4 +46,16 @@ public class CommonTest
Assert.Equal(Number.ToBit(0xAA, 3).Value, true);
Assert.Equal(Number.ToBit(0xAA, 2).Value, false);
}
[Fact]
public void ReverseBits()
{
Assert.Equal(BinaryPrimitives.ReverseEndianness((byte)0xA0), (byte)0x50);
var bytesSrc = new byte[] { 0xAB, 0x00, 0x00, 0x01 };
var bytes = new byte[4];
for (int i = 0; i < 4; i++)
bytes[i] = BinaryPrimitives.ReverseEndianness(bytesSrc[i]);
Assert.Equal(bytesSrc, new byte[] { 0xD5, 0x00, 0x00, 0x80 });
}
}