File indexing completed on 2024-05-05 04:55:40

0001 /**
0002  * \file maintest.cpp
0003  * Main program for executing unit test cases.
0004  * Besides the standard QtTest options, this test runner also allows to select
0005  * the testcase with "-testcase" and list the testcases with "-testcases".
0006  *
0007  * \b Project: Kid3
0008  * \author Urs Fleisch
0009  * \date 07 Oct 2012
0010  *
0011  * Copyright (C) 2012-2021  Urs Fleisch
0012  *
0013  * This file is part of Kid3.
0014  *
0015  * Kid3 is free software; you can redistribute it and/or modify
0016  * it under the terms of the GNU General Public License as published by
0017  * the Free Software Foundation; either version 2 of the License, or
0018  * (at your option) any later version.
0019  *
0020  * Kid3 is distributed in the hope that it will be useful,
0021  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0022  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0023  * GNU General Public License for more details.
0024  *
0025  * You should have received a copy of the GNU General Public License
0026  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0027  */
0028 
0029 #include <QCoreApplication>
0030 #include <QStringList>
0031 #include "testutils.h"
0032 #include "testmusicbrainzreleaseimportparser.h"
0033 #include "testmusicbrainzreleaseimporter.h"
0034 #include "testdiscogsimporter.h"
0035 #include "testamazonimporter.h"
0036 
0037 /**
0038  * Main routine for test runner.
0039  *
0040  * @param argc number of arguments (including the command)
0041  * @param argv command and arguments
0042  *
0043  * @return 0 if OK, the number of failed tests if failed.
0044  */
0045 int main(int argc, char *argv[])
0046 {
0047   QCoreApplication app(argc, argv);
0048   QStringList args = app.arguments();
0049 
0050   static QObject* const testCases[] = {
0051     new TestMusicBrainzReleaseImportParser,
0052     new TestMusicBrainzReleaseImporter,
0053     new TestDiscogsImporter,
0054     new TestAmazonImporter,
0055     nullptr
0056   };
0057 
0058   QObject ts;
0059   for (QObject* const* tcPtr = testCases; *tcPtr; ++tcPtr) {
0060     (*tcPtr)->setParent(&ts);
0061   }
0062   return TestUtils::runTestSuite(ts, args);
0063 }