mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-09 23:15:40 +00:00
test: 100% coverage on Wrap for all types
This commit is contained in:
parent
3f47a4ec44
commit
3d2baf595b
104
X10D.Tests/src/Math/ByteTests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/ByteTests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class ByteTests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const byte value = 10;
|
||||
const byte low = 10;
|
||||
const byte high = 20;
|
||||
|
||||
byte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const byte value = 20;
|
||||
const byte low = 10;
|
||||
const byte high = 20;
|
||||
|
||||
byte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const byte value = 30;
|
||||
const byte low = 10;
|
||||
const byte high = 20;
|
||||
|
||||
byte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const byte value = 5;
|
||||
const byte low = 10;
|
||||
const byte high = 20;
|
||||
|
||||
byte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(11, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const byte value = 15;
|
||||
const byte low = 10;
|
||||
const byte high = 20;
|
||||
|
||||
byte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const byte value = 10;
|
||||
const byte length = 10;
|
||||
|
||||
byte result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const byte value = 5;
|
||||
const byte length = 10;
|
||||
|
||||
byte result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const byte value = 15;
|
||||
const byte length = 10;
|
||||
|
||||
byte result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using X10D.Math;
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
public class ByteTests
|
||||
public partial class ByteTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DigitalRootShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/DecimalTests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/DecimalTests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class DecimalTests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const decimal value = 10;
|
||||
const decimal low = 10;
|
||||
const decimal high = 20;
|
||||
|
||||
decimal result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const decimal value = 20;
|
||||
const decimal low = 10;
|
||||
const decimal high = 20;
|
||||
|
||||
decimal result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const decimal value = 30;
|
||||
const decimal low = 10;
|
||||
const decimal high = 20;
|
||||
|
||||
decimal result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const decimal value = 5;
|
||||
const decimal low = 10;
|
||||
const decimal high = 20;
|
||||
|
||||
decimal result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(15.0m, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const decimal value = 15;
|
||||
const decimal low = 10;
|
||||
const decimal high = 20;
|
||||
|
||||
decimal result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const decimal value = 10;
|
||||
const decimal length = 10;
|
||||
|
||||
decimal result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0.0m, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const decimal value = 5;
|
||||
const decimal length = 10;
|
||||
|
||||
decimal result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const decimal value = 15;
|
||||
const decimal length = 10;
|
||||
|
||||
decimal result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5.0m, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using X10D.Math;
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
public class DecimalTests
|
||||
public partial class DecimalTests
|
||||
{
|
||||
#if NETCOREAPP3_0_OR_GREATER
|
||||
[TestMethod]
|
||||
|
104
X10D.Tests/src/Math/DoubleTests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/DoubleTests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class DoubleTests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const double value = 10;
|
||||
const double low = 10;
|
||||
const double high = 20;
|
||||
|
||||
double result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const double value = 20;
|
||||
const double low = 10;
|
||||
const double high = 20;
|
||||
|
||||
double result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const double value = 30;
|
||||
const double low = 10;
|
||||
const double high = 20;
|
||||
|
||||
double result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const double value = 5;
|
||||
const double low = 10;
|
||||
const double high = 20;
|
||||
|
||||
double result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(15.0, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const double value = 15;
|
||||
const double low = 10;
|
||||
const double high = 20;
|
||||
|
||||
double result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const double value = 10;
|
||||
const double length = 10;
|
||||
|
||||
double result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0.0, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const double value = 5;
|
||||
const double length = 10;
|
||||
|
||||
double result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const double value = 15;
|
||||
const double length = 10;
|
||||
|
||||
double result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5.0, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using X10D.Math;
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
public class DoubleTests
|
||||
public partial class DoubleTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DegreesToRadians_ShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/Int16Tests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/Int16Tests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class Int16Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const short value = 10;
|
||||
const short low = 10;
|
||||
const short high = 20;
|
||||
|
||||
short result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const short value = 20;
|
||||
const short low = 10;
|
||||
const short high = 20;
|
||||
|
||||
short result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const short value = 30;
|
||||
const short low = 10;
|
||||
const short high = 20;
|
||||
|
||||
short result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const short value = 5;
|
||||
const short low = 10;
|
||||
const short high = 20;
|
||||
|
||||
short result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(15, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const short value = 15;
|
||||
const short low = 10;
|
||||
const short high = 20;
|
||||
|
||||
short result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const short value = 10;
|
||||
const short length = 10;
|
||||
|
||||
short result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const short value = 5;
|
||||
const short length = 10;
|
||||
|
||||
short result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const short value = 15;
|
||||
const short length = 10;
|
||||
|
||||
short result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using X10D.Math;
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
public class Int16Tests
|
||||
public partial class Int16Tests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DigitalRootShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/Int32Tests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/Int32Tests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class Int32Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const int value = 10;
|
||||
const int low = 10;
|
||||
const int high = 20;
|
||||
|
||||
int result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const int value = 20;
|
||||
const int low = 10;
|
||||
const int high = 20;
|
||||
|
||||
int result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const int value = 30;
|
||||
const int low = 10;
|
||||
const int high = 20;
|
||||
|
||||
int result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const int value = 5;
|
||||
const int low = 10;
|
||||
const int high = 20;
|
||||
|
||||
int result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(15, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const int value = 15;
|
||||
const int low = 10;
|
||||
const int high = 20;
|
||||
|
||||
int result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const int value = 10;
|
||||
const int length = 10;
|
||||
|
||||
int result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const int value = 5;
|
||||
const int length = 10;
|
||||
|
||||
int result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const int value = 15;
|
||||
const int length = 10;
|
||||
|
||||
int result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using X10D.Math;
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
public class Int32Tests
|
||||
public partial class Int32Tests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DigitalRootShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/Int64Tests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/Int64Tests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class Int64Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const long value = 10;
|
||||
const long low = 10;
|
||||
const long high = 20;
|
||||
|
||||
long result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const long value = 20;
|
||||
const long low = 10;
|
||||
const long high = 20;
|
||||
|
||||
long result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const long value = 30;
|
||||
const long low = 10;
|
||||
const long high = 20;
|
||||
|
||||
long result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const long value = 5;
|
||||
const long low = 10;
|
||||
const long high = 20;
|
||||
|
||||
long result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(15L, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const long value = 15;
|
||||
const long low = 10;
|
||||
const long high = 20;
|
||||
|
||||
long result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const long value = 10;
|
||||
const long length = 10;
|
||||
|
||||
long result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0L, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const long value = 5;
|
||||
const long length = 10;
|
||||
|
||||
long result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const long value = 15;
|
||||
const long length = 10;
|
||||
|
||||
long result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5L, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using X10D.Math;
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
public class Int64Tests
|
||||
public partial class Int64Tests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DigitalRootShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/SByteTests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/SByteTests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class SByteTests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const sbyte value = 10;
|
||||
const sbyte low = 10;
|
||||
const sbyte high = 20;
|
||||
|
||||
sbyte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const sbyte value = 20;
|
||||
const sbyte low = 10;
|
||||
const sbyte high = 20;
|
||||
|
||||
sbyte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const sbyte value = 30;
|
||||
const sbyte low = 10;
|
||||
const sbyte high = 20;
|
||||
|
||||
sbyte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const sbyte value = 5;
|
||||
const sbyte low = 10;
|
||||
const sbyte high = 20;
|
||||
|
||||
sbyte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(15, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const sbyte value = 15;
|
||||
const sbyte low = 10;
|
||||
const sbyte high = 20;
|
||||
|
||||
sbyte result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const sbyte value = 10;
|
||||
const sbyte length = 10;
|
||||
|
||||
sbyte result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const sbyte value = 5;
|
||||
const sbyte length = 10;
|
||||
|
||||
sbyte result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const sbyte value = 15;
|
||||
const sbyte length = 10;
|
||||
|
||||
sbyte result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
[CLSCompliant(false)]
|
||||
public class SByteTests
|
||||
public partial class SByteTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DigitalRootShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/SingleTests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/SingleTests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class SingleTests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const float value = 10;
|
||||
const float low = 10;
|
||||
const float high = 20;
|
||||
|
||||
float result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const float value = 20;
|
||||
const float low = 10;
|
||||
const float high = 20;
|
||||
|
||||
float result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const float value = 30;
|
||||
const float low = 10;
|
||||
const float high = 20;
|
||||
|
||||
float result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const float value = 5;
|
||||
const float low = 10;
|
||||
const float high = 20;
|
||||
|
||||
float result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(15.0f, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const float value = 15;
|
||||
const float low = 10;
|
||||
const float high = 20;
|
||||
|
||||
float result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const float value = 10;
|
||||
const float length = 10;
|
||||
|
||||
float result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0.0f, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const float value = 5;
|
||||
const float length = 10;
|
||||
|
||||
float result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const float value = 15;
|
||||
const float length = 10;
|
||||
|
||||
float result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5.0f, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ using X10D.Math;
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
public class SingleTests
|
||||
public partial class SingleTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DegreesToRadians_ShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/UInt16Tests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/UInt16Tests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class UInt16Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const ushort value = 10;
|
||||
const ushort low = 10;
|
||||
const ushort high = 20;
|
||||
|
||||
ushort result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const ushort value = 20;
|
||||
const ushort low = 10;
|
||||
const ushort high = 20;
|
||||
|
||||
ushort result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const ushort value = 30;
|
||||
const ushort low = 10;
|
||||
const ushort high = 20;
|
||||
|
||||
ushort result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const ushort value = 5;
|
||||
const ushort low = 10;
|
||||
const ushort high = 20;
|
||||
|
||||
ushort result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(11U, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const ushort value = 15;
|
||||
const ushort low = 10;
|
||||
const ushort high = 20;
|
||||
|
||||
ushort result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const ushort value = 10;
|
||||
const ushort length = 10;
|
||||
|
||||
ushort result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0U, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const ushort value = 5;
|
||||
const ushort length = 10;
|
||||
|
||||
ushort result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const ushort value = 15;
|
||||
const ushort length = 10;
|
||||
|
||||
ushort result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5U, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
[CLSCompliant(false)]
|
||||
public class UInt16Tests
|
||||
public partial class UInt16Tests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DigitalRootShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/UInt32Tests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/UInt32Tests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class UInt32Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const uint value = 10;
|
||||
const uint low = 10;
|
||||
const uint high = 20;
|
||||
|
||||
uint result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const uint value = 20;
|
||||
const uint low = 10;
|
||||
const uint high = 20;
|
||||
|
||||
uint result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const uint value = 30;
|
||||
const uint low = 10;
|
||||
const uint high = 20;
|
||||
|
||||
uint result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const uint value = 5;
|
||||
const uint low = 10;
|
||||
const uint high = 20;
|
||||
|
||||
uint result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(11U, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const uint value = 15;
|
||||
const uint low = 10;
|
||||
const uint high = 20;
|
||||
|
||||
uint result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const uint value = 10;
|
||||
const uint length = 10;
|
||||
|
||||
uint result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0U, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const uint value = 5;
|
||||
const uint length = 10;
|
||||
|
||||
uint result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const uint value = 15;
|
||||
const uint length = 10;
|
||||
|
||||
uint result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5U, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
[CLSCompliant(false)]
|
||||
public class UInt32Tests
|
||||
public partial class UInt32Tests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DigitalRootShouldBeCorrect()
|
||||
|
104
X10D.Tests/src/Math/UInt64Tests.Wrap.cs
Normal file
104
X10D.Tests/src/Math/UInt64Tests.Wrap.cs
Normal file
@ -0,0 +1,104 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
public partial class UInt64Tests
|
||||
{
|
||||
[TestClass]
|
||||
public class WrapTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnLow_WhenValueIsEqualToLow()
|
||||
{
|
||||
const ulong value = 10;
|
||||
const ulong low = 10;
|
||||
const ulong high = 20;
|
||||
|
||||
ulong result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnHigh_WhenValueIsEqualToHigh()
|
||||
{
|
||||
const ulong value = 20;
|
||||
const ulong low = 10;
|
||||
const ulong high = 20;
|
||||
|
||||
ulong result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanHigh()
|
||||
{
|
||||
const ulong value = 30;
|
||||
const ulong low = 10;
|
||||
const ulong high = 20;
|
||||
|
||||
ulong result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(low, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsLessThanLow()
|
||||
{
|
||||
const ulong value = 5;
|
||||
const ulong low = 10;
|
||||
const ulong high = 20;
|
||||
|
||||
ulong result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(11UL, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsInBetweenLowAndHigh()
|
||||
{
|
||||
const ulong value = 15;
|
||||
const ulong low = 10;
|
||||
const ulong high = 20;
|
||||
|
||||
ulong result = value.Wrap(low, high);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnZero_WhenValueIsEqualToLength()
|
||||
{
|
||||
const ulong value = 10;
|
||||
const ulong length = 10;
|
||||
|
||||
ulong result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(0UL, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnValue_WhenValueIsLessThanLength()
|
||||
{
|
||||
const ulong value = 5;
|
||||
const ulong length = 10;
|
||||
|
||||
ulong result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(value, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Wrap_ShouldReturnCorrectResult_WhenValueIsGreaterThanLength()
|
||||
{
|
||||
const ulong value = 15;
|
||||
const ulong length = 10;
|
||||
|
||||
ulong result = value.Wrap(length);
|
||||
|
||||
Assert.AreEqual(5UL, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using X10D.Math;
|
||||
|
||||
namespace X10D.Tests.Math;
|
||||
|
||||
[TestClass]
|
||||
[CLSCompliant(false)]
|
||||
public class UInt64Tests
|
||||
public partial class UInt64Tests
|
||||
{
|
||||
[TestMethod]
|
||||
public void DigitalRootShouldBeCorrect()
|
||||
|
Loading…
Reference in New Issue
Block a user