annotate base/test/svcore-base-test.cpp @ 1742:52705a328b34 by-id

Rejig ById so as to put everything in a single pool, so that at the core you can go from numeric id (untyped) to anything the object can be dynamic_cast to. Useful for building other abstractions like PlayParameter-type registrations that don't know about e.g. Models. Probably some more tweaking needed. Also add tests
author Chris Cannam
date Fri, 28 Jun 2019 17:36:30 +0100
parents 172bd3374adf
children
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@1742 23 #include "TestById.h"
Chris@1615 24 #include "TestEventSeries.h"
Chris@1622 25 #include "StressEventSeries.h"
Chris@879 26
Chris@1601 27 #include "system/Init.h"
Chris@1601 28
Chris@879 29 #include <QtTest>
Chris@879 30
Chris@879 31 #include <iostream>
Chris@879 32
Chris@879 33 int main(int argc, char *argv[])
Chris@879 34 {
Chris@879 35 int good = 0, bad = 0;
Chris@879 36
Chris@1601 37 // This is necessary to ensure correct behaviour of snprintf with
Chris@1601 38 // older MinGW implementations
Chris@1601 39 svSystemSpecificInitialisation();
Chris@1601 40
Chris@879 41 QCoreApplication app(argc, argv);
Chris@1392 42 app.setOrganizationName("sonic-visualiser");
Chris@879 43 app.setApplicationName("test-svcore-base");
Chris@879 44
Chris@879 45 {
Chris@1429 46 TestRangeMapper t;
Chris@1429 47 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 48 else ++bad;
Chris@879 49 }
Chris@892 50 {
Chris@1429 51 TestPitch t;
Chris@1429 52 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 53 else ++bad;
Chris@892 54 }
Chris@1012 55 {
Chris@1262 56 TestOurRealTime t;
Chris@1429 57 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 58 else ++bad;
Chris@1262 59 }
Chris@1262 60 {
Chris@1262 61 TestVampRealTime t;
Chris@1429 62 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 63 else ++bad;
Chris@1012 64 }
Chris@1022 65 {
Chris@1429 66 TestStringBits t;
Chris@1429 67 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 68 else ++bad;
Chris@1022 69 }
Chris@1265 70 {
Chris@1429 71 TestColumnOp t;
Chris@1429 72 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 73 else ++bad;
Chris@1265 74 }
Chris@1392 75 {
Chris@1429 76 TestLogRange t;
Chris@1429 77 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 78 else ++bad;
Chris@1392 79 }
Chris@1407 80 {
Chris@1429 81 TestScaleTickIntervals t;
Chris@1429 82 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1429 83 else ++bad;
Chris@1407 84 }
Chris@1573 85 {
Chris@1573 86 TestMovingMedian t;
Chris@1573 87 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1573 88 else ++bad;
Chris@1573 89 }
Chris@1612 90 {
Chris@1615 91 TestEventSeries t;
Chris@1612 92 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1612 93 else ++bad;
Chris@1612 94 }
Chris@1742 95 {
Chris@1742 96 TestById t;
Chris@1742 97 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1742 98 else ++bad;
Chris@1742 99 }
Chris@1742 100
Chris@1742 101 #ifdef NOT_DEFINED
Chris@1622 102 {
Chris@1622 103 StressEventSeries t;
Chris@1622 104 if (QTest::qExec(&t, argc, argv) == 0) ++good;
Chris@1622 105 else ++bad;
Chris@1622 106 }
Chris@1742 107 #endif
Chris@1622 108
Chris@879 109 if (bad > 0) {
Chris@1428 110 SVCERR << "\n********* " << bad << " test suite(s) failed!\n" << endl;
Chris@1428 111 return 1;
Chris@879 112 } else {
Chris@1428 113 SVCERR << "All tests passed" << endl;
Chris@1428 114 return 0;
Chris@879 115 }
Chris@879 116 }