// //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion public bool TestSDFT(double[] x) { WWComplex[] Xexpected = null; WWDftCpu.Dft1d(WWComplex.FromRealArray(x), out Xexpected); var sdft = new WWSlidingDFT(x.Length); WWComplex[] Xactual = null; for (int i = 0; i < x.Length; ++i) { Xactual = sdft.Filter(x[i]); } return(WWComplex.AverageDistance(Xexpected, Xactual) < 1e-8); }
public bool TestSDFT_LastN(double[] x, int N) { System.Diagnostics.Debug.Assert(N <= x.Length); var xLastN = new double[N]; Array.Copy(x, x.Length - N, xLastN, 0, N); WWComplex[] Xexpected = null; WWDftCpu.Dft1d(WWComplex.FromRealArray(xLastN), out Xexpected); var sdft = new WWSlidingDFT(N); WWComplex[] Xactual = null; for (int i = 0; i < x.Length; ++i) { Xactual = sdft.Filter(x[i]); } return(WWComplex.AverageDistance(Xexpected, Xactual) < 1e-8); }