You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
763 B
31 lines
763 B
|
4 weeks ago
|
using Xunit;
|
||
|
|
using leak_test_project.Utils;
|
||
|
|
|
||
|
|
namespace leak_test_project.Tests.Utils
|
||
|
|
{
|
||
|
|
public class SentinelCrc8Tests
|
||
|
|
{
|
||
|
|
[Theory]
|
||
|
|
[InlineData("ABC", "40")] // 0x41 ^ 0x42 ^ 0x43 = 0x40
|
||
|
|
[InlineData("123", "30")] // 0x31 ^ 0x32 ^ 0x33 = 0x30
|
||
|
|
public void CalculateHex_ShouldReturnXorSum(string input, string expected)
|
||
|
|
{
|
||
|
|
// Act
|
||
|
|
var result = SentinelCrc8.CalculateHex(input);
|
||
|
|
|
||
|
|
// Assert
|
||
|
|
Assert.Equal(expected, result);
|
||
|
|
}
|
||
|
|
|
||
|
|
[Fact]
|
||
|
|
public void CalculateHex_EmptyString_ShouldReturn00()
|
||
|
|
{
|
||
|
|
// Act
|
||
|
|
var result = SentinelCrc8.CalculateHex("");
|
||
|
|
|
||
|
|
// Assert
|
||
|
|
Assert.Equal("00", result);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|