public void TestInterpolateComplex() { double[] x = { 1, 2, 3, 4 }; Complex[] y = { Complex.FromPolarCoordinates(1, 1), Complex.FromPolarCoordinates(2, 2), Complex.FromPolarCoordinates(3, 3), Complex.FromPolarCoordinates(4, 4) }; double[] x2 = { 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5 }; var result = Dsp.InterpolateComplex(x, y, x2).ToReadOnlyList(); Assert.That(result.Count == x2.Length); FilterAssert.ListIsMonotonouslyRising(result.Select(c => c.Magnitude)); Assert.GreaterOrEqual(result[0].Magnitude, 0); Assert.GreaterOrEqual(result[result.Count - 1].Magnitude, 4); Assert.LessOrEqual(result[0].Magnitude, 1); Assert.LessOrEqual(result[result.Count - 1].Magnitude, 5); Assert.Throws <ArgumentNullException>(() => Dsp.InterpolateComplex(null, y, x2).ToReadOnlyList()); Assert.Throws <ArgumentNullException>(() => Dsp.InterpolateComplex(x, null, x2).ToReadOnlyList()); Assert.Throws <ArgumentNullException>(() => Dsp.InterpolateComplex(x, y, null).ToReadOnlyList()); Assert.Catch <Exception>(() => Dsp.InterpolateComplex(x2, y, x2).ToReadOnlyList()); }