comparison data/fileio/test/CSVStreamWriterTest.h @ 1494:0d4f1fcad97a

Remove some debug output
author Chris Cannam
date Thu, 09 Aug 2018 16:45:17 +0100
parents 743c38b209d0
children 560453546749
comparison
equal deleted inserted replaced
1487:71202259002d 1494:0d4f1fcad97a
254 std::ostringstream oss; 254 std::ostringstream oss;
255 MultiSelection regions; 255 MultiSelection regions;
256 regions.addSelection({0, 2}); 256 regions.addSelection({0, 2});
257 regions.addSelection({4, 6}); 257 regions.addSelection({4, 6});
258 regions.addSelection({16, 18}); 258 regions.addSelection({16, 18});
259 qDebug("End frame: %lld", (long long int)mwm.getEndFrame()); 259 // qDebug("End frame: %lld", (long long int)mwm.getEndFrame());
260 const std::string expectedOutput { 260 const std::string expectedOutput {
261 "0,0,0\n" 261 "0,0,0\n"
262 "1,0,0\n" 262 "1,0,0\n"
263 "4,1,1\n" 263 "4,1,1\n"
264 "5,1,1\n" 264 "5,1,1\n"
276 ); 276 );
277 QVERIFY( wroteMultiSection == true ); 277 QVERIFY( wroteMultiSection == true );
278 QVERIFY( reporter.getCallCount() == 3 ); 278 QVERIFY( reporter.getCallCount() == 3 );
279 const std::vector<int> expectedCallLog { 33, 66, 100 }; 279 const std::vector<int> expectedCallLog { 33, 66, 100 };
280 QVERIFY( reporter.getPercentageLog() == expectedCallLog ); 280 QVERIFY( reporter.getPercentageLog() == expectedCallLog );
281 qDebug("%s", oss.str().c_str()); 281 // qDebug("%s", oss.str().c_str());
282 QVERIFY( oss.str() == expectedOutput ); 282 QVERIFY( oss.str() == expectedOutput );
283 } 283 }
284 284
285 void writeSparseModel() 285 void writeSparseModel()
286 { 286 {
298 sv_frame_t startFrame = 0; 298 sv_frame_t startFrame = 0;
299 for (const auto& note : cMajorPentatonic) { 299 for (const auto& note : cMajorPentatonic) {
300 notes.addPoint({startFrame, note, 4, 1.f, ""}); 300 notes.addPoint({startFrame, note, 4, 1.f, ""});
301 startFrame += 8; 301 startFrame += 8;
302 } 302 }
303 qDebug("Create Expected Output\n"); 303 // qDebug("Create Expected Output\n");
304 304
305 // NB. removed end line break 305 // NB. removed end line break
306 const auto expectedOutput = notes.toDelimitedDataString(",").trimmed(); 306 const auto expectedOutput = notes.toDelimitedDataString(",").trimmed();
307 307
308 StubReporter reporter { []() -> bool { return false; } }; 308 StubReporter reporter { []() -> bool { return false; } };
309 std::ostringstream oss; 309 std::ostringstream oss;
310 qDebug("End frame: %lld", (long long int)notes.getEndFrame()); 310 // qDebug("End frame: %lld", (long long int)notes.getEndFrame());
311 qDebug("Write streaming\n"); 311 // qDebug("Write streaming\n");
312 const auto wroteSparseModel = CSVStreamWriter::writeInChunks( 312 const auto wroteSparseModel = CSVStreamWriter::writeInChunks(
313 oss, 313 oss,
314 notes, 314 notes,
315 &reporter, 315 &reporter,
316 ",", 316 ",",
317 DataExportDefaults, 317 DataExportDefaults,
318 2 318 2
319 ); 319 );
320 320
321 qDebug("\n%s\n", expectedOutput.toLocal8Bit().data()); 321 // qDebug("\n%s\n", expectedOutput.toLocal8Bit().data());
322 qDebug("\n%s\n", oss.str().c_str()); 322 // qDebug("\n%s\n", oss.str().c_str());
323 QVERIFY( wroteSparseModel == true ); 323 QVERIFY( wroteSparseModel == true );
324 QVERIFY( oss.str() == expectedOutput.toStdString() ); 324 QVERIFY( oss.str() == expectedOutput.toStdString() );
325 } 325 }
326 }; 326 };
327 327