fix: reboot very slow after remote update\

This commit is contained in:
2025-05-05 14:24:22 +08:00
parent 55e363d505
commit f75b245abc
5 changed files with 142 additions and 46 deletions

View File

@@ -41,21 +41,21 @@ public class CommonTest
[Fact]
public void ToBitTest()
{
Assert.Equal(Number.ToBit(0xFF, 3).Value, true);
Assert.Equal(Number.ToBit(0x00, 3).Value, false);
Assert.Equal(Number.ToBit(0xAA, 3).Value, true);
Assert.Equal(Number.ToBit(0xAA, 2).Value, false);
Assert.Equal(true, Number.ToBit(0xFF, 3).Value);
Assert.Equal(false, Number.ToBit(0x00, 3).Value);
Assert.Equal(true, Number.ToBit(0xAA, 3).Value);
Assert.Equal(false, Number.ToBit(0xAA, 2).Value);
}
[Fact]
public void ReverseBits()
{
Assert.Equal(BinaryPrimitives.ReverseEndianness((byte)0xA0), (byte)0x50);
Assert.Equal((byte)0x05, Common.Number.ReverseBits((byte)0xA0));
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 });
bytes[i] = Common.Number.ReverseBits(bytesSrc[i]);
Assert.Equal(new byte[] { 0xD5, 0x00, 0x00, 0x80 }, bytes);
}
}