Mercurial > hg > svcore
diff data/fileio/test/svcore-data-fileio-test.cpp @ 1430:b5283878cca2 streaming-csv-writer
Introduce a TestHelper which contains boiler plate for running a suite of QtTest style objects. Stub CSVStreamWriter and test to integrate into build.
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Tue, 17 Apr 2018 10:03:49 +0100 |
parents | 667e369cfeab |
children | de385fed1197 |
line wrap: on
line diff
--- a/data/fileio/test/svcore-data-fileio-test.cpp Mon Oct 09 11:09:21 2017 +0100 +++ b/data/fileio/test/svcore-data-fileio-test.cpp Tue Apr 17 10:03:49 2018 +0100 @@ -12,19 +12,15 @@ COPYING included with this distribution for more information. */ +#include "../../../test/TestHelper.h" #include "AudioFileReaderTest.h" #include "AudioFileWriterTest.h" #include "EncodingTest.h" #include "MIDIFileReaderTest.h" - -#include <QtTest> - -#include <iostream> +#include "CSVStreamWriterTest.h" int main(int argc, char *argv[]) { - int good = 0, bad = 0; - QString testDir; #ifdef Q_OS_WIN @@ -42,40 +38,16 @@ cerr << "Setting test directory base path to \"" << testDir << "\"" << endl; } - QCoreApplication app(argc, argv); - app.setOrganizationName("sonic-visualiser"); - app.setApplicationName("test-fileio"); - - { - AudioFileReaderTest t(testDir); - if (QTest::qExec(&t, argc, argv) == 0) ++good; - else ++bad; - } - - { - AudioFileWriterTest t(testDir); - if (QTest::qExec(&t, argc, argv) == 0) ++good; - else ++bad; - } - - { - EncodingTest t(testDir); - if (QTest::qExec(&t, argc, argv) == 0) ++good; - else ++bad; - } - - { - MIDIFileReaderTest t(testDir); - if (QTest::qExec(&t, argc, argv) == 0) ++good; - else ++bad; - } - - if (bad > 0) { - cerr << "\n********* " << bad << " test suite(s) failed!\n" << endl; - return 1; - } else { - cerr << "All tests passed" << endl; - return 0; - } + return Test::startTestRunner( + { + Test::createFactory<AudioFileReaderTest>(testDir), + Test::createFactory<AudioFileWriterTest>(testDir), + Test::createFactory<EncodingTest>(testDir), + Test::createFactory<MIDIFileReaderTest>(testDir), + Test::createFactory<CSVStreamWriterTest>() + }, + argc, + argv, + "test-fileio" + ); } -