1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-12 22:25:40 +00:00

test: add tests for INumber<T>.Sign

This commit is contained in:
Oliver Booth 2024-06-12 13:15:54 +01:00
parent e51296d285
commit d022a71ce6
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5

View File

@ -0,0 +1,32 @@
#if NET7_0_OR_GREATER
using NUnit.Framework;
using X10D.Math;
namespace X10D.Tests.Numerics;
[TestFixture]
internal class NumberTests
{
[Test]
public void Sign_ShouldReturn1_GivenPositiveNumber()
{
Assert.That(NumberExtensions.Sign(2), Is.Positive);
Assert.That(NumberExtensions.Sign(2), Is.EqualTo(1));
}
[Test]
public void Sign_Should0_GivenZero()
{
Assert.That(NumberExtensions.Sign(0), Is.Not.Positive);
Assert.That(NumberExtensions.Sign(0), Is.Not.Negative);
Assert.That(NumberExtensions.Sign(0), Is.EqualTo(0));
}
[Test]
public void Sign_ShouldReturnNegative1_GivenNegativeNumber()
{
Assert.That(NumberExtensions.Sign(-2), Is.Negative);
Assert.That(NumberExtensions.Sign(-2), Is.EqualTo(-1));
}
}
#endif