comparison 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
comparison
equal deleted inserted replaced
1436:d61d6c33f14d 1437:de385fed1197
10 published by the Free Software Foundation; either version 2 of the 10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file 11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information. 12 COPYING included with this distribution for more information.
13 */ 13 */
14 14
15 #include "../../../test/TestHelper.h"
16 #include "AudioFileReaderTest.h" 15 #include "AudioFileReaderTest.h"
17 #include "AudioFileWriterTest.h" 16 #include "AudioFileWriterTest.h"
18 #include "EncodingTest.h" 17 #include "EncodingTest.h"
19 #include "MIDIFileReaderTest.h" 18 #include "MIDIFileReaderTest.h"
20 #include "CSVStreamWriterTest.h" 19 #include "CSVStreamWriterTest.h"
21 20
21 #include <QtTest>
22
23 #include <iostream>
24
22 int main(int argc, char *argv[]) 25 int main(int argc, char *argv[])
23 { 26 {
27 int good = 0, bad = 0;
28
24 QString testDir; 29 QString testDir;
25 30
26 #ifdef Q_OS_WIN 31 #ifdef Q_OS_WIN
27 // incredible to have to hardcode this, but I just can't figure out how to 32 // incredible to have to hardcode this, but I just can't figure out how to
28 // get QMAKE_POST_LINK to add an arg to its command successfully on Windows 33 // get QMAKE_POST_LINK to add an arg to its command successfully on Windows
36 41
37 if (testDir != "") { 42 if (testDir != "") {
38 cerr << "Setting test directory base path to \"" << testDir << "\"" << endl; 43 cerr << "Setting test directory base path to \"" << testDir << "\"" << endl;
39 } 44 }
40 45
41 return Test::startTestRunner( 46 QCoreApplication app(argc, argv);
42 { 47 app.setOrganizationName("sonic-visualiser");
43 Test::createFactory<AudioFileReaderTest>(testDir), 48 app.setApplicationName("test-fileio");
44 Test::createFactory<AudioFileWriterTest>(testDir), 49
45 Test::createFactory<EncodingTest>(testDir), 50 {
46 Test::createFactory<MIDIFileReaderTest>(testDir), 51 AudioFileReaderTest t(testDir);
47 Test::createFactory<CSVStreamWriterTest>() 52 if (QTest::qExec(&t, argc, argv) == 0) ++good;
48 }, 53 else ++bad;
49 argc, 54 }
50 argv, 55
51 "test-fileio" 56 {
52 ); 57 AudioFileWriterTest t(testDir);
58 if (QTest::qExec(&t, argc, argv) == 0) ++good;
59 else ++bad;
60 }
61
62 {
63 EncodingTest t(testDir);
64 if (QTest::qExec(&t, argc, argv) == 0) ++good;
65 else ++bad;
66 }
67
68 {
69 MIDIFileReaderTest t(testDir);
70 if (QTest::qExec(&t, argc, argv) == 0) ++good;
71 else ++bad;
72 }
73
74 {
75 CSVStreamWriterTest t;
76 if (QTest::qExec(&t, argc, argv) == 0) ++good;
77 else ++bad;
78 }
79
80 if (bad > 0) {
81 cerr << "\n********* " << bad << " test suite(s) failed!\n" << endl;
82 return 1;
83 } else {
84 cerr << "All tests passed" << endl;
85 return 0;
86 }
53 } 87 }