示例#1
0
 public void ReadNumChannelsTest(FixtureModel model)
 {
     if (model.Process.ContainsKey(FixtureModel.FlacHeaderExtractor))
     {
         Fin <byte> channels = Flac.ReadNumChannels(model.ToTargetInformation(this.RealFileSystem).FileStream);
         Assert.True(channels.IsSucc);
         ((byte)channels).Should().Be((byte)model.Record.Channels);
     }
 }
示例#2
0
 public void ReadBitDepthTest(FixtureModel model)
 {
     if (model.Process.ContainsKey(FixtureModel.FlacHeaderExtractor))
     {
         Fin <byte> bitDepth = Flac.ReadBitDepth(model.ToTargetInformation(this.RealFileSystem).FileStream);
         Assert.True(bitDepth.IsSucc);
         ((byte)bitDepth).Should().Be(model.Record.BitDepth);
     }
 }
示例#3
0
 public void ReadSampleRateTest(FixtureModel model)
 {
     if (model.Process.ContainsKey(FixtureModel.FlacHeaderExtractor))
     {
         Fin <uint> sampleRate = Flac.ReadSampleRate(model.ToTargetInformation(this.RealFileSystem).FileStream);
         Assert.True(sampleRate.IsSucc);
         ((uint)sampleRate).Should().Be(model.Record.SampleRateHertz);
     }
 }
示例#4
0
 public void ReadTotalSamplesTest(FixtureModel model)
 {
     if (model.Process.ContainsKey(FixtureModel.FlacHeaderExtractor))
     {
         Fin <ulong> totalSamples = Flac.ReadTotalSamples(model.ToTargetInformation(this.RealFileSystem).FileStream);
         Assert.True(totalSamples.IsSucc);
         ((ulong)totalSamples).Should().Be(model.Record.TotalSamples);
     }
 }
        public void HasLogFileTest(FixtureModel model)
        {
            if (model.Process.ContainsKey(FixtureModel.FrontierLabsLogFileExtractor))
            {
                TargetInformation ti = model.ToTargetInformation(this.RealFileSystem);

                Assert.True(ti.TargetSupportFiles.ContainsKey(LogFile.LogFileKey));
            }
        }
        private (byte[] FormatChunk, RangeHelper.Range DataChunk) ReadChunkRanges(FixtureModel model)
        {
            using var stream = model.ToTargetInformation(this.RealFileSystem).FileStream;

            var riffChunk   = Wave.FindRiffChunk(stream);
            var waveChunk   = riffChunk.Bind(r => Wave.FindWaveChunk(stream, r));
            var formatChunk = waveChunk.Bind(w => Wave.FindFormatChunk(stream, w));
            var dataChunk   = waveChunk.Bind(w => Wave.FindDataChunk(stream, w));

            var formatSpan = RangeHelper.ReadRange(stream, (RangeHelper.Range)formatChunk);

            return(formatSpan.ToArray(), (RangeHelper.Range)dataChunk);
        }
示例#7
0
        public void HasMetadataBlockTest(FixtureModel model)
        {
            bool hasMetadata = Flac.HasMetadataBlock(model.ToTargetInformation(this.RealFileSystem).FileStream).IfFail(false);

            ((bool)hasMetadata).Should().Be(model.IsFlac && model.ValidMetadata != ValidMetadata.No);
        }
示例#8
0
        public void IsFlacFileTest(FixtureModel model)
        {
            bool isFlac = Flac.IsFlacFile(model.ToTargetInformation(this.RealFileSystem).FileStream).IfFail(false);

            isFlac.Should().Be(model.IsFlac);
        }
示例#9
0
        public void HasFrontierLabsVorbisComment(FixtureModel model)
        {
            bool hasComment = FrontierLabs.HasFrontierLabsVorbisComment(model.ToTargetInformation(this.RealFileSystem).FileStream).IfFail(false);

            hasComment.Should().Be(model.Process.ContainsKey(FixtureModel.FlacCommentExtractor));
        }