Unverified Commit 3dc3663e authored by Maikel Llamaret Heredia's avatar Maikel Llamaret Heredia Committed by GitHub

Add files via upload

parent a82699bb
#!/bin/sh
# Run all unit tests
# The name of each qt project file should be the same as that of its containing
# directory. For example, unit test "testversioncompare" has the following
# directory hierachy:
# testversioncompare/
# testversioncompare.pro
# testversioncompare.cpp
# testversioncompare.h
TMP_OUTPUT=tmp-output.txt
run_command() {
"$@"
STATUS=$?
if [ $STATUS -ne 0 ]; then
cat $TMP_OUTPUT
rm -f $TMP_OUTPUT
echo "$1 returned exit status $STATUS"
exit 1
fi
rm -f $TMP_OUTPUT
}
run_test() {
DIR="$1"
cd "$DIR"
if [ -f "${DIR}.pro" ]; then
echo "running test: ${DIR}"
run_command qmake
run_command make
run_command ./${DIR}
else
echo "warning: ${DIR}/${DIR}.pro not found"
fi
cd ..
}
for dir in *; do
if [ -d "$dir" ]; then # it is a directory
run_test "$dir"
fi
done
/* MystiQ - a qt4 gui frontend for ffmpeg
* Copyright (C) 2011-2013 Timothy Lin <lzh9102@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "testupdateinfoparser.h"
QTEST_MAIN(TestUpdateInfoParser)
void TestUpdateInfoParser::testParseXml()
{
const char *xml =
"<?xml version=\"1.0\"?>"
"<MystiQVersionInfo>"
"<Name>0.1.8</Name>"
"<ReleaseDate>20120213</ReleaseDate>"
"<ReleaseNotes>release notes</ReleaseNotes>"
"</MystiQVersionInfo>";
XmlUpdateInfoParser parser;
bool success = parser.parse(QString(xml));
QVERIFY(success);
QCOMPARE(QString("0.1.8"), parser.version());
QCOMPARE(QString("20120213"), parser.releaseDate());
QCOMPARE(QString("release notes"), parser.releaseNotes());
/* download link not tested because it varies across platforms */
}
/* MystiQ - a qt4 gui frontend for ffmpeg
* Copyright (C) 2011-2013 Timothy Lin <lzh9102@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TESTUPDATEINFOPARSER_H
#define TESTUPDATEINFOPARSER_H
#include <QtTest/QtTest>
#include "../../services/updateinfoparser.h"
class TestUpdateInfoParser : public QObject
{
Q_OBJECT
private slots:
void testParseXml();
};
#endif // TESTUPDATEINFOPARSER_H
######################################################################
# Automatically generated by qmake (2.01a) ?? 7? 19 11:46:16 2013
######################################################################
CONFIG += qtestlib
TEMPLATE = app
TARGET = testupdateinfoparser
# Input
HEADERS += testupdateinfoparser.h ../../services/updateinfoparser.h \
../../services/xmllookuptable.cpp
SOURCES += testupdateinfoparser.cpp ../../services/updateinfoparser.cpp \
../../services/xmllookuptable.cpp
/* MystiQ - a qt4 gui frontend for ffmpeg
* Copyright (C) 2011-2013 Timothy Lin <lzh9102@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "testversioncompare.h"
QTEST_MAIN(TestVersionCompare)
void TestVersionCompare::testVersionEquality()
{
Version v1("0.1.0"), v2("0.1.0"), v3("1.1.0");
QCOMPARE(v1, v2);
QVERIFY(v1 != v3);
QVERIFY(v2 != v3);
QVERIFY(!(v1 == v3));
QVERIFY(!(v2 == v3));
QVERIFY(!(v1 != v2));
}
void TestVersionCompare::testVersionInequality()
{
const int COUNT = 10;
Version *v[COUNT*COUNT*COUNT] = {0};
for (int i=0; i<COUNT; i++)
for (int k=0; k<COUNT; k++)
for (int u=0; u<COUNT; u++) {
v[i*COUNT*COUNT+k*COUNT+u] =
new Version(QString("%1.%2.%3").arg(i).arg(k).arg(u));
}
for (int i=0; i<COUNT*COUNT*COUNT-1; i++) {
const Version& v1 = *v[i];
const Version& v2 = *v[i+1];
QVERIFY(v1 != v2);
QVERIFY(v1 < v2);
QVERIFY(v2 > v1);
QVERIFY(v1 <= v1);
QVERIFY(v1 >= v1);
}
for (int i=0; i<COUNT*COUNT*COUNT; i++)
delete v[i];
}
void TestVersionCompare::testVersionSingleRange()
{
#define CHECK_CONTAIN(v) QVERIFY(range.containsVersion(Version(v)))
#define CHECK_NOT_CONTAIN(v) QVERIFY(!range.containsVersion(Version(v)))
VersionRange range("0.1.0~0.2.1");
CHECK_CONTAIN("0.1.0");
CHECK_CONTAIN("0.2.1");
CHECK_CONTAIN("0.1.1");
CHECK_CONTAIN("0.2.0");
CHECK_CONTAIN("0.1.10");
CHECK_NOT_CONTAIN("0.0.9");
CHECK_NOT_CONTAIN("0.0.10");
CHECK_NOT_CONTAIN("0.2.2");
CHECK_NOT_CONTAIN("0.2.10");
}
/* MystiQ - a qt4 gui frontend for ffmpeg
* Copyright (C) 2011-2013 Timothy Lin <lzh9102@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TESTVERSIONCOMPARE_H
#define TESTVERSIONCOMPARE_H
#include <QtTest/QtTest>
#include "../../services/versioncompare.h"
class TestVersionCompare : public QObject
{
Q_OBJECT
private slots:
void testVersionEquality();
void testVersionInequality();
void testVersionSingleRange();
};
#endif // TESTVERSIONCOMPARE_H
######################################################################
# Automatically generated by qmake (2.01a) ?? 7? 2 21:43:55 2013
######################################################################
CONFIG += qtestlib
TARGET = testversioncompare
TEMPLATE = app
# Directories
HEADERS += \
testversioncompare.h
SOURCES += \
testversioncompare.cpp \
../../services/versioncompare.cpp
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment