comparison data/fileio/test/svcore-data-fileio-test.cpp @ 1365:3382d914e110

Merge from branch 3.0-integration
author Chris Cannam
date Fri, 13 Jan 2017 10:29:44 +0000
parents 1c9bbbb6116a
children 667e369cfeab
comparison
equal deleted inserted replaced
1272:6a7ea3bd0e10 1365:3382d914e110
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2 /*
3 Sonic Visualiser
4 An audio file viewer and annotation editor.
5 Centre for Digital Music, Queen Mary, University of London.
6 This file copyright 2013 Chris Cannam.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #include "AudioFileReaderTest.h"
16 #include "AudioFileWriterTest.h"
17 #include "EncodingTest.h"
18 #include "MIDIFileReaderTest.h"
19
20 #include <QtTest>
21
22 #include <iostream>
23
24 int main(int argc, char *argv[])
25 {
26 int good = 0, bad = 0;
27
28 QString testDir;
29
30 #ifdef Q_OS_WIN
31 // incredible to have to hardcode this, but I just can't figure out how to
32 // get QMAKE_POST_LINK to add an arg to its command successfully on Windows
33 testDir = "../sonic-visualiser/svcore/data/fileio/test";
34 #endif
35
36 if (argc > 1) {
37 cerr << "argc = " << argc << endl;
38 testDir = argv[1];
39 }
40
41 if (testDir != "") {
42 cerr << "Setting test directory base path to \"" << testDir << "\"" << endl;
43 }
44
45 QCoreApplication app(argc, argv);
46 app.setOrganizationName("Sonic Visualiser");
47 app.setApplicationName("test-fileio");
48
49 {
50 AudioFileReaderTest t(testDir);
51 if (QTest::qExec(&t, argc, argv) == 0) ++good;
52 else ++bad;
53 }
54
55 {
56 AudioFileWriterTest t(testDir);
57 if (QTest::qExec(&t, argc, argv) == 0) ++good;
58 else ++bad;
59 }
60
61 {
62 EncodingTest t(testDir);
63 if (QTest::qExec(&t, argc, argv) == 0) ++good;
64 else ++bad;
65 }
66
67 {
68 MIDIFileReaderTest t(testDir);
69 if (QTest::qExec(&t, argc, argv) == 0) ++good;
70 else ++bad;
71 }
72
73 if (bad > 0) {
74 cerr << "\n********* " << bad << " test suite(s) failed!\n" << endl;
75 return 1;
76 } else {
77 cerr << "All tests passed" << endl;
78 return 0;
79 }
80 }
81