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

Function testProcessStereo

test/SndFileAudioFileReaderTest.cpp:144–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142//------------------------------------------------------------------------------
143
144static void testProcessStereo(const std::string& filename, const std::string& format)
145{
146 boost::filesystem::path path = "../test/data";
147 path /= filename;
148
149 SndFileAudioFileReader reader;
150
151 ASSERT_NO_THROW(reader.open(path.c_str()));
152
153 StrictMock<MockAudioProcessor> processor;
154
155 InSequence sequence; // Calls expected in the order listed below.
156
157 EXPECT_CALL(processor, init(16000, 2, 113519, 16384)).WillOnce(Return(true));
158 EXPECT_CALL(processor, shouldContinue()).WillOnce(Return(true));
159
160 // Total number of frames: 113519, 13 x 8192 frames then 1 x 7023
161 EXPECT_CALL(processor, process(_, 8192)).Times(13).WillRepeatedly(Return(true));
162 EXPECT_CALL(processor, process(_, 7023)).Times(1).WillOnce(Return(true));
163 EXPECT_CALL(processor, done());
164
165 bool result = reader.run(processor);
166 ASSERT_TRUE(result);
167
168 ASSERT_THAT(output.str(), StrEq(""));
169 ASSERT_THAT(error.str(), StartsWith(
170 "Input file: " + path.string() + "\n"
171 "Frames: 113519\n"
172 "Sample rate: 16000 Hz\n"
173 "Channels: 2\n"
174 "Format: " + format + "\n"
175 "Sections: 1\n"
176 "Seekable: yes\n"
177 ));
178 ASSERT_THAT(error.str(), EndsWith(
179 "Read 113519 frames\n"
180 ));
181}
182
183//------------------------------------------------------------------------------
184

Callers 1

TEST_FFunction · 0.85

Calls 3

initFunction · 0.85
openMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected