diff data/fileio/test/svcore-data-fileio-test.cpp @ 1437:de385fed1197 streaming-csv-writer

Revert to adding a test case in the style of the existing file
author Lucas Thompson <dev@lucas.im>
date Tue, 17 Apr 2018 10:03:49 +0100
parents b5283878cca2
children a12fd0456f0c
line wrap: on
line diff
--- a/data/fileio/test/svcore-data-fileio-test.cpp	Tue Apr 17 10:03:49 2018 +0100
+++ b/data/fileio/test/svcore-data-fileio-test.cpp	Tue Apr 17 10:03:49 2018 +0100
@@ -12,15 +12,20 @@
     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 "CSVStreamWriterTest.h"
 
+#include <QtTest>
+
+#include <iostream>
+
 int main(int argc, char *argv[])
 {
+    int good = 0, bad = 0;
+
     QString testDir;
 
 #ifdef Q_OS_WIN
@@ -38,16 +43,45 @@
         cerr << "Setting test directory base path to \"" << testDir << "\"" << endl;
     }
 
-    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"
-    );
+    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;
+    }
+
+    {
+        CSVStreamWriterTest t;
+        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;
+    }
 }