Chris@756: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@879: /* Chris@879: Sonic Visualiser Chris@879: An audio file viewer and annotation editor. Chris@879: Centre for Digital Music, Queen Mary, University of London. Chris@879: This file copyright 2013 Chris Cannam. Chris@879: Chris@879: This program is free software; you can redistribute it and/or Chris@879: modify it under the terms of the GNU General Public License as Chris@879: published by the Free Software Foundation; either version 2 of the Chris@879: License, or (at your option) any later version. See the file Chris@879: COPYING included with this distribution for more information. Chris@879: */ Chris@756: Chris@756: #include "AudioFileReaderTest.h" Chris@1698: #include "BogusAudioFileReaderTest.h" Chris@1359: #include "AudioFileWriterTest.h" Chris@1345: #include "EncodingTest.h" Chris@1359: #include "MIDIFileReaderTest.h" Chris@1524: #include "CSVFormatTest.h" dev@1430: #include "CSVStreamWriterTest.h" Chris@756: Chris@1601: #include "system/Init.h" Chris@1601: Chris@756: #include Chris@756: Chris@756: #include Chris@756: Chris@756: int main(int argc, char *argv[]) Chris@756: { Chris@756: int good = 0, bad = 0; Chris@756: Chris@1601: svSystemSpecificInitialisation(); Chris@1601: Chris@1346: QString testDir; Chris@1346: Chris@1346: #ifdef Q_OS_WIN Chris@1346: // incredible to have to hardcode this, but I just can't figure out how to Chris@1346: // get QMAKE_POST_LINK to add an arg to its command successfully on Windows Chris@1716: testDir = "svcore/data/fileio/test"; Chris@1346: #endif Chris@1346: Chris@756: QCoreApplication app(argc, argv); Chris@1392: app.setOrganizationName("sonic-visualiser"); Chris@1524: app.setApplicationName("test-svcore-data-fileio"); Chris@756: Chris@1607: if (argc == 3 && string(argv[1]) == "--testdir") { Chris@1607: testDir = argv[2]; Chris@1607: argc = 1; Chris@1607: } Chris@1607: Chris@1504: if (testDir != "") { Chris@1504: SVCERR << "Setting test directory base path to \"" << testDir << "\"" << endl; Chris@1504: } Chris@1504: Chris@756: { Chris@1346: AudioFileReaderTest t(testDir); Chris@1346: if (QTest::qExec(&t, argc, argv) == 0) ++good; Chris@1346: else ++bad; Chris@756: } Chris@756: Chris@1345: { Chris@1359: AudioFileWriterTest t(testDir); Chris@1359: if (QTest::qExec(&t, argc, argv) == 0) ++good; Chris@1359: else ++bad; Chris@1359: } Chris@1359: Chris@1359: { Chris@1698: BogusAudioFileReaderTest t; Chris@1698: if (QTest::qExec(&t, argc, argv) == 0) ++good; Chris@1698: else ++bad; Chris@1698: } Chris@1698: Chris@1698: { Chris@1346: EncodingTest t(testDir); Chris@1346: if (QTest::qExec(&t, argc, argv) == 0) ++good; Chris@1346: else ++bad; Chris@1345: } Chris@1345: Chris@1359: { Chris@1359: MIDIFileReaderTest t(testDir); Chris@1359: if (QTest::qExec(&t, argc, argv) == 0) ++good; Chris@1359: else ++bad; Chris@1359: } Chris@1359: dev@1437: { Chris@1524: CSVFormatTest t(testDir); Chris@1524: if (QTest::qExec(&t, argc, argv) == 0) ++good; Chris@1524: else ++bad; Chris@1524: } Chris@1524: Chris@1524: { dev@1437: CSVStreamWriterTest t; dev@1437: if (QTest::qExec(&t, argc, argv) == 0) ++good; dev@1437: else ++bad; dev@1437: } dev@1437: Chris@756: if (bad > 0) { Chris@1524: SVCERR << "\n********* " << bad << " test suite(s) failed!\n" << endl; Chris@1429: return 1; Chris@756: } else { Chris@1524: SVCERR << "All tests passed" << endl; Chris@1429: return 0; Chris@756: } Chris@756: } Chris@1714: