| 197 | //------------------------------------------------------------------------------ |
| 198 | |
| 199 | static 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 | |