public void TestInterpolateNearest()
        {
            var signal = new Signal(new double[] { 1, 2, 3, 4 })
            {
                Start = 1, Finish = 4, SamplingInterval = 1
            };
            var newSignal = WaveMath.InterpolateNearest(signal, 2);

            Assert.AreEqual("1 2 2 3 3 4 4", newSignal.ToString(0));
            Assert.AreEqual(1, newSignal.Start);
            Assert.AreEqual(4, newSignal.Finish);
            Assert.AreEqual(0.5, newSignal.SamplingInterval);
            Assert.AreEqual(2, newSignal.SamplingRate);

            signal = new Signal(new double[] { -7, 4, 8, -2, 1, -55, 2 })
            {
                Start = -1, Finish = 2, SamplingInterval = 4d / 7d
            };
            newSignal = WaveMath.Interpolate(signal, 7, InterpolationModeEnum.Nearest);
            Assert.AreEqual("-7 -7 -7 -7 4 4 4 4 4 4 4 8 8 8 8 8 8 8 -2 -2 -2 -2 -2 -2 -2 1 1 1 1 1 1 1 -55 -55 -55 -55 -55 -55 -55 2 2 2 2", newSignal.ToString(0));
            Assert.AreEqual(-1, newSignal.Start);
            Assert.AreEqual(2, newSignal.Finish);
            Assert.AreEqual(4d / 7d / 7d, newSignal.SamplingInterval);
            Assert.AreEqual(Convert.ToInt32(1 / (4d / 7d / 7d)), newSignal.SamplingRate);

            signal = new Signal(new double[] { -7, 4, 8, -2, 1, -55, 2 })
            {
                Start = 1, Finish = 4, SamplingInterval = 4d / 7d
            };
            newSignal = WaveMath.InterpolateNearest(signal, 1);
            Assert.AreEqual("-7, 4, 8, -2, 1, -55, 2", newSignal.ToString(0, ", "));
            Assert.AreEqual(1, newSignal.Start);
            Assert.AreEqual(4, newSignal.Finish);
            Assert.AreEqual(4d / 7d, newSignal.SamplingInterval);
            Assert.AreEqual(Convert.ToInt32(1 / (4d / 7d)), newSignal.SamplingRate);
        }