MCPcopy Create free account
hub / github.com/bbc/audiowaveform / testProcessMono

Function testProcessMono

test/SndFileAudioFileReaderTest.cpp:199–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197//------------------------------------------------------------------------------
198
199static void testProcessMono(const std::string& filename, const std::string& format)
200{
201 boost::filesystem::path path = "../test/data";
202 path /= filename;
203
204 SndFileAudioFileReader reader;
205
206 ASSERT_NO_THROW(reader.open(path.c_str()));
207
208 StrictMock<MockAudioProcessor> processor;
209
210 InSequence sequence; // Calls expected in the order listed below.
211
212 EXPECT_CALL(processor, init(16000, 1, 113519, 16384)).WillOnce(Return(true));
213 EXPECT_CALL(processor, shouldContinue()).WillOnce(Return(true));
214
215 // Total number of frames: 113519, 6 x 16384 frames then 1 x 15215
216 EXPECT_CALL(processor, process(_, 16384)).Times(6).WillRepeatedly(Return(true));
217 EXPECT_CALL(processor, process(_, 15215)).Times(1).WillOnce(Return(true));
218 EXPECT_CALL(processor, done());
219
220 bool result = reader.run(processor);
221 ASSERT_TRUE(result);
222
223 ASSERT_THAT(output.str(), StrEq(""));
224 ASSERT_THAT(error.str(), StartsWith(
225 "Input file: " + path.string() + "\n"
226 "Frames: 113519\n"
227 "Sample rate: 16000 Hz\n"
228 "Channels: 1\n"
229 "Format: " + format + "\n"
230 "Sections: 1\n"
231 "Seekable: yes\n"
232 ));
233 ASSERT_THAT(error.str(), EndsWith(
234 "Read 113519 frames\n"
235 ));
236}
237
238//------------------------------------------------------------------------------
239

Callers 1

TEST_FFunction · 0.85

Calls 3

initFunction · 0.85
openMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected