Exemple #1
0
        [DataRow(10, 30, -20)]  // Source is shorter than frame
        public void CheckWithNaiveImplementation(int destinationLength, int windowLength, int position)
        {
            var random      = new Random(57);
            var destination = Enumerable.Range(0, destinationLength).Select(t => random.NextDouble()).ToArray();
            var frame       = Enumerable.Range(0, windowLength).Select(t => (Complex)random.NextDouble()).ToArray();
            var window      = WindowFunctions.Hann(windowLength);

            var expected = destination.ToArray();

            OverlapAdd_Naive(expected, frame, window, position);

            var actual = destination.ToArray();

            Framing.OverlapAdd(actual, frame, window, position);

            for (var t = 0; t < actual.Length; t++)
            {
                Assert.AreEqual(expected[t], actual[t], 1.0E-9);
            }
        }