Esempio n. 1
0
        public void TheSummaryDataWillCondenseTheSampleSetDownToASetOfLocalMaxima()
        {
            var exampleData = new float[1024];
            exampleData[0x012] = 0.8f;
            exampleData[0x013] = -0.7f;
            exampleData[0x134] = 0.75f;
            exampleData[0x135] = -0.5f;
            exampleData[0x256] = 0.29f;
            exampleData[0x257] = -0.3f;
            exampleData[0x378] = 0.99f;
            exampleData[0x379] = -0.98f;

            var frameData = new FrameData(exampleData, exampleData);
            var summary = _waveSummaryBuilder.MakeSummaryData(frameData, 0x100);

            var resultSet = new[]{ 0.8f, 0.75f, 0.3f, 0.99f };

            Assert.Equal(resultSet, summary.Left);
        }
Esempio n. 2
0
 public void AnInputSetOfACertainSizeWillCondenseToAKnownSize(int condensationRatio, int inputSetSize, int expectedOutputSetSize)
 {
     var frameData = new FrameData(new float[inputSetSize], new float[inputSetSize]);
     var summary = _waveSummaryBuilder.MakeSummaryData(frameData, condensationRatio);
     Assert.Equal(expectedOutputSetSize, summary.Length);
 }
Esempio n. 3
0
 public void FrameDataConstructionWillThrowIfMismatchedFrameBuffersAreSupplied()
 {
     // ReSharper disable once UnusedVariable
     Assert.Throws(typeof(ArgumentException), () => { var dummy = new FrameData(new float[4], new float[5]); });
 }
Esempio n. 4
0
 public void GetSubsetWillThrowIfStartIsLargerThanSizeOfSourceData()
 {
     var sourceData = new FrameData(new float[4], new float[4]);
     Assert.Throws(typeof(ArgumentOutOfRangeException), () => { sourceData.GetSubset(5, 1); });
 }
Esempio n. 5
0
 public void SubsetWillTruncateIfArrayBoundsAreExceededByStartPlusCount(int expected, int start, int count)
 {
     var sourceData = new FrameData(new float[4], new float[4]);
     Assert.Equal(expected, sourceData.GetSubset(start, count).Length);
 }
Esempio n. 6
0
 public void FrameDataCopyingWillSucceedIfArrayBoundsAreHonoured()
 {
     var sourceData = new FrameData(new float[4], new float[4]);
     Assert.NotNull(sourceData.GetSubset(3, 1));
 }