annotate data/fileio/test/svcore-data-fileio-test.cpp @ 1693:718ce5fb9fec single-point

Merge
author Chris Cannam
date Thu, 25 Apr 2019 11:30:51 +0100
parents a77fc6da288b
children dbd13eb7dad1
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"
Chris@1524 19 #include "CSVFormatTest.h"
dev@1430 20 #include "CSVStreamWriterTest.h"
Chris@756 21
Chris@1601 22 #include "system/Init.h"
Chris@1601 23
Chris@756 24 #include <QtTest>
Chris@756 25
Chris@756 26 #include <iostream>
Chris@756 27
Chris@756 28 int main(int argc, char *argv[])
Chris@756 29 {
Chris@756 30 int good = 0, bad = 0;
Chris@756 31
Chris@1601 32 svSystemSpecificInitialisation();
Chris@1601 33
Chris@1346 34 QString testDir;
Chris@1346 35
Chris@1346 36 #ifdef Q_OS_WIN
Chris@1346 37 // incredible to have to hardcode this, but I just can't figure out how to
Chris@1346 38 // get QMAKE_POST_LINK to add an arg to its command successfully on Windows
Chris@1346 39 testDir = "../sonic-visualiser/svcore/data/fileio/test";
Chris@1346 40 #endif
Chris@1346 41
Chris@756 42 QCoreApplication app(argc, argv);
Chris@1392 43 app.setOrganizationName("sonic-visualiser");
Chris@1524 44 app.setApplicationName("test-svcore-data-fileio");
Chris@756 45
Chris@1607 46 if (argc == 3 && string(argv[1]) == "--testdir") {
Chris@1607 47 testDir = argv[2];
Chris@1607 48 argc = 1;
Chris@1607 49 }
Chris@1607 50
Chris@1504 51 if (testDir != "") {
Chris@1504 52 SVCERR << "Setting test directory base path to \"" << testDir << "\"" << endl;
Chris@1504 53 }
Chris@1504 54
Chris@756 55 {
Chris@1346 56 AudioFileReaderTest t(testDir);
Chris@1346 57 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1346 58 else ++bad;
Chris@756 59 }
Chris@756 60
Chris@1345 61 {
Chris@1359 62 AudioFileWriterTest t(testDir);
Chris@1359 63 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1359 64 else ++bad;
Chris@1359 65 }
Chris@1359 66
Chris@1359 67 {
Chris@1346 68 EncodingTest t(testDir);
Chris@1346 69 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1346 70 else ++bad;
Chris@1345 71 }
Chris@1345 72
Chris@1359 73 {
Chris@1359 74 MIDIFileReaderTest t(testDir);
Chris@1359 75 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1359 76 else ++bad;
Chris@1359 77 }
Chris@1359 78
dev@1437 79 {
Chris@1524 80 CSVFormatTest t(testDir);
Chris@1524 81 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1524 82 else ++bad;
Chris@1524 83 }
Chris@1524 84
Chris@1524 85 {
dev@1437 86 CSVStreamWriterTest t;
dev@1437 87 if (QTest::qExec(&t, argc, argv) == 0) ++good;
dev@1437 88 else ++bad;
dev@1437 89 }
dev@1437 90
Chris@756 91 if (bad > 0) {
Chris@1524 92 SVCERR << "\n********* " << bad << " test suite(s) failed!\n" << endl;
Chris@1429 93 return 1;
Chris@756 94 } else {
Chris@1524 95 SVCERR << "All tests passed" << endl;
Chris@1429 96 return 0;
Chris@756 97 }
Chris@756 98 }