1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-15 13:05:41 +00:00
X10D/X10D.Tests/src/Numerics/ByteTests.cs

43 lines
1.1 KiB
C#
Raw Normal View History

using Microsoft.VisualStudio.TestTools.UnitTesting;
using X10D.Numerics;
namespace X10D.Tests.Numerics;
[TestClass]
public class ByteTests
{
[TestMethod]
public void RotateLeft_ShouldRotateCorrectly()
{
const byte value = 181; // 10110101
const byte expected = 91; // 01011011
Assert.AreEqual(value, value.RotateLeft(0));
Assert.AreEqual(expected, value.RotateLeft(4));
}
[TestMethod]
public void RotateLeft_ShouldModForLargeCount()
{
const byte value = 181; // 10110101
Assert.AreEqual(value, value.RotateLeft(8));
}
[TestMethod]
public void RotateRight_ShouldRotateCorrectly()
{
const byte value = 181; // 10110101
const byte expected = 91; // 01011011
Assert.AreEqual(value, value.RotateRight(0));
Assert.AreEqual(expected, value.RotateRight(4));
}
[TestMethod]
public void RotateRight_ShouldModForLargeCount()
{
const byte value = 181; // 10110101
Assert.AreEqual(value, value.RotateRight(8));
}
}