annotate data/fileio/test/svcore-data-fileio-test.cpp @ 1506:a250a54c11cc

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