This commit is contained in:
chi
2025-04-23 09:57:01 +09:00
parent 5d286d5179
commit 9d2467d50a
8 changed files with 178 additions and 116 deletions

View File

@@ -9,14 +9,14 @@ namespace ENIGProtocol.Tests
public void TestCRC16Calculation()
{
// 테스트 데이터
byte[] testData = new byte[] { 0x02,0x00,0xFF };
byte[] testData = new byte[] { 0x02,0x00,0xFF }; //payload에는 stx, len, ... crc,etx 는 제외한다
// CRC16 계산
var protocol = new EEProtocol();
ushort crc = protocol.CalculateCRC16(testData);
// 예상 결과와 비교
Assert.Equal(0x1789, crc); // 실제 예상값으로 수정 필요
Assert.Equal(0x1789, crc);
}
[Fact]
@@ -40,6 +40,7 @@ namespace ENIGProtocol.Tests
{
// 패킷 파싱 테스트
var protocol = new EEProtocol();
//byte[] testPacket = new byte[] { 0x02, 0x04, 0x01, 0x02, 0x03, 0x04, 0x12, 0x34, 0x03 };
byte[] testPacket = new byte[] { 0x02, 0x02, 0x00, 0xFF, 0x89, 0x17, 0x03 };