1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:25:43 +00:00

Add tests for ComplexInfinity

This commit is contained in:
Oliver Booth 2022-04-21 12:44:50 +01:00
parent 8008a4a9ef
commit d9277dbbf6
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634
2 changed files with 35 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Numerics;
namespace X10D.Tests.Core;
@ -11,6 +12,22 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class DoubleTests
{
[TestMethod]
public void ComplexSqrt()
{
Assert.AreEqual(0.0, 0.0.ComplexSqrt());
Assert.AreEqual(1.414213562373095, 2.0.ComplexSqrt());
Assert.AreEqual(3.0, 9.0.ComplexSqrt());
Assert.AreEqual(4.0, 16.0.ComplexSqrt());
Assert.AreEqual(new Complex(1.414213562373095, 1), (-2.0).ComplexSqrt());
Assert.AreEqual(new Complex(3.0, 1), (-9.0).ComplexSqrt());
Assert.AreEqual(new Complex(4.0, 1), (-16.0).ComplexSqrt());
Assert.AreEqual(Complex.NaN, double.NaN.ComplexSqrt());
Assert.AreEqual(new Complex(1, 1), (-1.0).ComplexSqrt());
Assert.AreEqual(Complex.Infinity, double.NegativeInfinity.ComplexSqrt());
Assert.AreEqual(Complex.Infinity, double.PositiveInfinity.ComplexSqrt());
}
/// <summary>
/// Test for <see cref="DoubleExtensions.LerpTo" />
/// </summary>

View File

@ -1,10 +1,27 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Numerics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace X10D.Tests.Core;
[TestClass]
public class SingleTests
{
[TestMethod]
public void ComplexSqrt()
{
Assert.AreEqual(0.0f, 0.0f.ComplexSqrt());
Assert.AreEqual(1.4142135f, 2.0f.ComplexSqrt());
Assert.AreEqual(3.0f, 9.0f.ComplexSqrt());
Assert.AreEqual(4.0f, 16.0f.ComplexSqrt());
Assert.AreEqual(new Complex(1.4142135f, 1), (-2.0f).ComplexSqrt());
Assert.AreEqual(new Complex(3.0f, 1), (-9.0f).ComplexSqrt());
Assert.AreEqual(new Complex(4.0f, 1), (-16.0f).ComplexSqrt());
Assert.AreEqual(Complex.NaN, float.NaN.ComplexSqrt());
Assert.AreEqual(new Complex(1, 1), (-1.0f).ComplexSqrt());
Assert.AreEqual(Complex.Infinity, float.NegativeInfinity.ComplexSqrt());
Assert.AreEqual(Complex.Infinity, float.PositiveInfinity.ComplexSqrt());
}
[TestMethod]
public void DegreesToRadians()
{