annotate base/test/svcore-base-test.cpp @ 1611:b2f32c554199 single-point

Pull out the Point class, plus start testing NoteModel, plus actually add the tests...
author Chris Cannam
date Tue, 05 Mar 2019 15:15:11 +0000
parents a090221caeda
children 23a29e5dc0e9
rev   line source
Chris@879 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
Chris@879 7 This program is free software; you can redistribute it and/or
Chris@879 8 modify it under the terms of the GNU General Public License as
Chris@879 9 published by the Free Software Foundation; either version 2 of the
Chris@879 10 License, or (at your option) any later version. See the file
Chris@879 11 COPYING included with this distribution for more information.
Chris@879 12 */
Chris@879 13
Chris@1392 14 #include "TestLogRange.h"
Chris@883 15 #include "TestRangeMapper.h"
Chris@892 16 #include "TestPitch.h"
Chris@1407 17 #include "TestScaleTickIntervals.h"
Chris@1022 18 #include "TestStringBits.h"
Chris@1262 19 #include "TestOurRealTime.h"
Chris@1262 20 #include "TestVampRealTime.h"
Chris@1265 21 #include "TestColumnOp.h"
Chris@1573 22 #include "TestMovingMedian.h"
Chris@879 23
Chris@1601 24 #include "system/Init.h"
Chris@1601 25
Chris@879 26 #include <QtTest>
Chris@879 27
Chris@879 28 #include <iostream>
Chris@879 29
Chris@879 30 int main(int argc, char *argv[])
Chris@879 31 {
Chris@879 32 int good = 0, bad = 0;
Chris@879 33
Chris@1601 34 // This is necessary to ensure correct behaviour of snprintf with
Chris@1601 35 // older MinGW implementations
Chris@1601 36 svSystemSpecificInitialisation();
Chris@1601 37
Chris@879 38 QCoreApplication app(argc, argv);
Chris@1392 39 app.setOrganizationName("sonic-visualiser");
Chris@879 40 app.setApplicationName("test-svcore-base");
Chris@879 41
Chris@879 42 {
Chris@1429 43 TestRangeMapper t;
Chris@1429 44 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 45 else ++bad;
Chris@879 46 }
Chris@892 47 {
Chris@1429 48 TestPitch t;
Chris@1429 49 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 50 else ++bad;
Chris@892 51 }
Chris@1012 52 {
Chris@1262 53 TestOurRealTime t;
Chris@1429 54 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 55 else ++bad;
Chris@1262 56 }
Chris@1262 57 {
Chris@1262 58 TestVampRealTime t;
Chris@1429 59 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 60 else ++bad;
Chris@1012 61 }
Chris@1022 62 {
Chris@1429 63 TestStringBits t;
Chris@1429 64 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 65 else ++bad;
Chris@1022 66 }
Chris@1265 67 {
Chris@1429 68 TestColumnOp t;
Chris@1429 69 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 70 else ++bad;
Chris@1265 71 }
Chris@1392 72 {
Chris@1429 73 TestLogRange t;
Chris@1429 74 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 75 else ++bad;
Chris@1392 76 }
Chris@1407 77 {
Chris@1429 78 TestScaleTickIntervals t;
Chris@1429 79 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 80 else ++bad;
Chris@1407 81 }
Chris@1573 82 {
Chris@1573 83 TestMovingMedian t;
Chris@1573 84 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1573 85 else ++bad;
Chris@1573 86 }
Chris@879 87
Chris@879 88 if (bad > 0) {
Chris@1428 89 SVCERR << "\n********* " << bad << " test suite(s) failed!\n" << endl;
Chris@1428 90 return 1;
Chris@879 91 } else {
Chris@1428 92 SVCERR << "All tests passed" << endl;
Chris@1428 93 return 0;
Chris@879 94 }
Chris@879 95 }