TEST (AudioDataTest, PrependToNew) { KeyFinder::AudioData a; KeyFinder::AudioData b; ASSERT_NO_THROW(a.prepend(b)); ASSERT_EQ(0, a.getChannels()); ASSERT_EQ(0, a.getFrameRate()); b.setChannels(1); b.setFrameRate(1); b.addToFrameCount(1); ASSERT_NO_THROW(a.prepend(b)); ASSERT_EQ(1, a.getChannels()); ASSERT_EQ(1, a.getFrameRate()); ASSERT_EQ(1, a.getFrameCount()); }
TEST (LowPassFilterTest, DoesntAlterAudioMetadata) { KeyFinder::AudioData a; a.setChannels(1); a.setFrameRate(frameRate); a.addToSampleCount(frameRate); KeyFinder::LowPassFilter* lpf = new KeyFinder::LowPassFilter(filterOrder, frameRate, cornerFrequency, filterFFT); KeyFinder::Workspace w; lpf->filter(a, w); delete lpf; ASSERT_EQ(1, a.getChannels()); ASSERT_EQ(frameRate, a.getFrameRate()); ASSERT_EQ(frameRate, a.getSampleCount()); }
TEST (AudioDataTest, Channels) { KeyFinder::AudioData a; a.setChannels(2); ASSERT_EQ(2, a.getChannels()); ASSERT_THROW(a.setChannels(0), KeyFinder::Exception); }
TEST (AudioDataTest, ConstructorWorks) { KeyFinder::AudioData a; ASSERT_EQ(0, a.getChannels()); ASSERT_EQ(0, a.getFrameRate()); ASSERT_EQ(0, a.getSampleCount()); }