diff --git a/X10D.Tests/src/Math/ByteTests.Wrap.cs b/X10D.Tests/src/Math/ByteTests.Wrap.cs new file mode 100644 index 0000000..1713242 --- /dev/null +++ b/X10D.Tests/src/Math/ByteTests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/ByteTests.cs b/X10D.Tests/src/Math/ByteTests.cs index 854d4b9..791289b 100644 --- a/X10D.Tests/src/Math/ByteTests.cs +++ b/X10D.Tests/src/Math/ByteTests.cs @@ -4,7 +4,7 @@ using X10D.Math; namespace X10D.Tests.Math; [TestClass] -public class ByteTests +public partial class ByteTests { [TestMethod] public void DigitalRootShouldBeCorrect() diff --git a/X10D.Tests/src/Math/DecimalTests.Wrap.cs b/X10D.Tests/src/Math/DecimalTests.Wrap.cs new file mode 100644 index 0000000..a49fd30 --- /dev/null +++ b/X10D.Tests/src/Math/DecimalTests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/DecimalTests.cs b/X10D.Tests/src/Math/DecimalTests.cs index dadf650..eb0366a 100644 --- a/X10D.Tests/src/Math/DecimalTests.cs +++ b/X10D.Tests/src/Math/DecimalTests.cs @@ -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] diff --git a/X10D.Tests/src/Math/DoubleTests.Wrap.cs b/X10D.Tests/src/Math/DoubleTests.Wrap.cs new file mode 100644 index 0000000..ff53476 --- /dev/null +++ b/X10D.Tests/src/Math/DoubleTests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/DoubleTests.cs b/X10D.Tests/src/Math/DoubleTests.cs index f5ebe01..0ddb307 100644 --- a/X10D.Tests/src/Math/DoubleTests.cs +++ b/X10D.Tests/src/Math/DoubleTests.cs @@ -5,7 +5,7 @@ using X10D.Math; namespace X10D.Tests.Math; [TestClass] -public class DoubleTests +public partial class DoubleTests { [TestMethod] public void DegreesToRadians_ShouldBeCorrect() diff --git a/X10D.Tests/src/Math/Int16Tests.Wrap.cs b/X10D.Tests/src/Math/Int16Tests.Wrap.cs new file mode 100644 index 0000000..31054f4 --- /dev/null +++ b/X10D.Tests/src/Math/Int16Tests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/Int16Tests.cs b/X10D.Tests/src/Math/Int16Tests.cs index f2f8a31..f605cc0 100644 --- a/X10D.Tests/src/Math/Int16Tests.cs +++ b/X10D.Tests/src/Math/Int16Tests.cs @@ -4,7 +4,7 @@ using X10D.Math; namespace X10D.Tests.Math; [TestClass] -public class Int16Tests +public partial class Int16Tests { [TestMethod] public void DigitalRootShouldBeCorrect() diff --git a/X10D.Tests/src/Math/Int32Tests.Wrap.cs b/X10D.Tests/src/Math/Int32Tests.Wrap.cs new file mode 100644 index 0000000..ef8a29b --- /dev/null +++ b/X10D.Tests/src/Math/Int32Tests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/Int32Tests.cs b/X10D.Tests/src/Math/Int32Tests.cs index ef8e45b..252a17e 100644 --- a/X10D.Tests/src/Math/Int32Tests.cs +++ b/X10D.Tests/src/Math/Int32Tests.cs @@ -4,7 +4,7 @@ using X10D.Math; namespace X10D.Tests.Math; [TestClass] -public class Int32Tests +public partial class Int32Tests { [TestMethod] public void DigitalRootShouldBeCorrect() diff --git a/X10D.Tests/src/Math/Int64Tests.Wrap.cs b/X10D.Tests/src/Math/Int64Tests.Wrap.cs new file mode 100644 index 0000000..dd2a27d --- /dev/null +++ b/X10D.Tests/src/Math/Int64Tests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/Int64Tests.cs b/X10D.Tests/src/Math/Int64Tests.cs index 752d9d6..ac397ad 100644 --- a/X10D.Tests/src/Math/Int64Tests.cs +++ b/X10D.Tests/src/Math/Int64Tests.cs @@ -4,7 +4,7 @@ using X10D.Math; namespace X10D.Tests.Math; [TestClass] -public class Int64Tests +public partial class Int64Tests { [TestMethod] public void DigitalRootShouldBeCorrect() diff --git a/X10D.Tests/src/Math/SByteTests.Wrap.cs b/X10D.Tests/src/Math/SByteTests.Wrap.cs new file mode 100644 index 0000000..64b473a --- /dev/null +++ b/X10D.Tests/src/Math/SByteTests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/SByteTests.cs b/X10D.Tests/src/Math/SByteTests.cs index 2664a63..4d9b9e2 100644 --- a/X10D.Tests/src/Math/SByteTests.cs +++ b/X10D.Tests/src/Math/SByteTests.cs @@ -5,7 +5,7 @@ namespace X10D.Tests.Math; [TestClass] [CLSCompliant(false)] -public class SByteTests +public partial class SByteTests { [TestMethod] public void DigitalRootShouldBeCorrect() diff --git a/X10D.Tests/src/Math/SingleTests.Wrap.cs b/X10D.Tests/src/Math/SingleTests.Wrap.cs new file mode 100644 index 0000000..5d75ccb --- /dev/null +++ b/X10D.Tests/src/Math/SingleTests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/SingleTests.cs b/X10D.Tests/src/Math/SingleTests.cs index 2deb0ca..2162eb0 100644 --- a/X10D.Tests/src/Math/SingleTests.cs +++ b/X10D.Tests/src/Math/SingleTests.cs @@ -5,7 +5,7 @@ using X10D.Math; namespace X10D.Tests.Math; [TestClass] -public class SingleTests +public partial class SingleTests { [TestMethod] public void DegreesToRadians_ShouldBeCorrect() diff --git a/X10D.Tests/src/Math/UInt16Tests.Wrap.cs b/X10D.Tests/src/Math/UInt16Tests.Wrap.cs new file mode 100644 index 0000000..9704639 --- /dev/null +++ b/X10D.Tests/src/Math/UInt16Tests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/UInt16Tests.cs b/X10D.Tests/src/Math/UInt16Tests.cs index 4d74154..21e3def 100644 --- a/X10D.Tests/src/Math/UInt16Tests.cs +++ b/X10D.Tests/src/Math/UInt16Tests.cs @@ -5,7 +5,7 @@ namespace X10D.Tests.Math; [TestClass] [CLSCompliant(false)] -public class UInt16Tests +public partial class UInt16Tests { [TestMethod] public void DigitalRootShouldBeCorrect() diff --git a/X10D.Tests/src/Math/UInt32Tests.Wrap.cs b/X10D.Tests/src/Math/UInt32Tests.Wrap.cs new file mode 100644 index 0000000..0fefee7 --- /dev/null +++ b/X10D.Tests/src/Math/UInt32Tests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/UInt32Tests.cs b/X10D.Tests/src/Math/UInt32Tests.cs index 1573b9b..b2337d0 100644 --- a/X10D.Tests/src/Math/UInt32Tests.cs +++ b/X10D.Tests/src/Math/UInt32Tests.cs @@ -5,7 +5,7 @@ namespace X10D.Tests.Math; [TestClass] [CLSCompliant(false)] -public class UInt32Tests +public partial class UInt32Tests { [TestMethod] public void DigitalRootShouldBeCorrect() diff --git a/X10D.Tests/src/Math/UInt64Tests.Wrap.cs b/X10D.Tests/src/Math/UInt64Tests.Wrap.cs new file mode 100644 index 0000000..e28c49b --- /dev/null +++ b/X10D.Tests/src/Math/UInt64Tests.Wrap.cs @@ -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); + } + } +} diff --git a/X10D.Tests/src/Math/UInt64Tests.cs b/X10D.Tests/src/Math/UInt64Tests.cs index 35e8d4c..432e4f2 100644 --- a/X10D.Tests/src/Math/UInt64Tests.cs +++ b/X10D.Tests/src/Math/UInt64Tests.cs @@ -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()