Browse Source

transforms: facade test

Signed-off-by: Christoph Ruegg <git@cdrnet.ch>
pull/2/head
Christoph Ruegg 17 years ago
parent
commit
d8c22c249c
  1. 26
      src/UnitTests/IntegralTransformsTests/DftTest.cs
  2. 6
      src/UnitTests/IntegralTransformsTests/DhtTest.cs

26
src/UnitTests/IntegralTransformsTests/DftTest.cs

@ -38,7 +38,7 @@ namespace MathNet.Numerics.UnitTests.IntegralTransformsTests
[TestFixture] [TestFixture]
public class DftTest public class DftTest
{ {
private static Random _random = new Random(); private static readonly Random _random = new Random();
private static Complex[] ProvideSamples(int count) private static Complex[] ProvideSamples(int count)
{ {
@ -245,6 +245,30 @@ namespace MathNet.Numerics.UnitTests.IntegralTransformsTests
AssertHelpers.AlmostEqualList(samples, work, 1e-12); AssertHelpers.AlmostEqualList(samples, work, 1e-12);
} }
[Test]
public void DefaultTransformIsReversible()
{
var samples = ProvideSamples(0x7FFF);
var work = new Complex[samples.Length];
samples.CopyTo(work, 0);
Transform.FourierForward(work);
Assert.IsFalse(work.AlmostEqualListWithError(samples, 1e-12));
Transform.FourierInverse(work);
AssertHelpers.AlmostEqualList(samples, work, 1e-12);
Transform.FourierInverse(work, FourierOptions.Default);
Assert.IsFalse(work.AlmostEqualListWithError(samples, 1e-12));
Transform.FourierForward(work, FourierOptions.Default);
AssertHelpers.AlmostEqualList(samples, work, 1e-12);
}
[Test] [Test]
public void TransformSatisfiesParsevalsTheorem() public void TransformSatisfiesParsevalsTheorem()
{ {

6
src/UnitTests/IntegralTransformsTests/DhtTest.cs

@ -26,21 +26,17 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// </copyright> // </copyright>
using System.Collections.Generic;
namespace MathNet.Numerics.UnitTests.IntegralTransformsTests namespace MathNet.Numerics.UnitTests.IntegralTransformsTests
{ {
using System; using System;
using System.Linq;
using MbUnit.Framework; using MbUnit.Framework;
using IntegralTransforms; using IntegralTransforms;
using IntegralTransforms.Algorithms; using IntegralTransforms.Algorithms;
using Statistics;
[TestFixture] [TestFixture]
public class DhtTest public class DhtTest
{ {
private static Random _random = new Random(); private static readonly Random _random = new Random();
private static double[] ProvideSamples(int count) private static double[] ProvideSamples(int count)
{ {

Loading…
Cancel
Save