mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-15 15:55:40 +00:00
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
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));
|
|
}
|
|
}
|