~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to projectmanagers/cmake/tests/cmakeparserutilstest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2010-05-05 07:21:55 UTC
  • mfrom: (1.2.3 upstream) (5.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100505072155-h78lx19pu04sbhtn
Tags: 4:4.0.0-2
* Upload to unstable (Closes: #579947, #481832).
* Acknowledge obsolete NMU fixes (Closes: #562410, #546961).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* KDevelop CMake Support
 
2
 *
 
3
 * Copyright 2008 Matt Rogers <mattr@kde.org>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public License
 
7
 * as published by the Free Software Foundation; either version 2
 
8
 * of the License, or (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
18
 * 02110-1301, USA.
 
19
 */
 
20
 
 
21
#include "cmakeparserutilstest.h"
 
22
#include "cmakeparserutils.h"
 
23
 
 
24
QTEST_MAIN( CMakeParserUtilsTest )
 
25
 
 
26
void CMakeParserUtilsTest::validVersionsTest()
 
27
{
 
28
    bool ok = true;
 
29
    QList<int> versions;
 
30
    QFETCH(QString, version);
 
31
    versions = CMakeParserUtils::parseVersion(version, &ok);
 
32
    QVERIFY(ok == true);
 
33
    QVERIFY(versions.count() != 0);
 
34
}
 
35
 
 
36
void CMakeParserUtilsTest::validVersionsTest_data()
 
37
{
 
38
    QTest::addColumn<QString>("version");
 
39
    QTest::newRow("zero major version") << QString("0");
 
40
    QTest::newRow("small major version") << QString("2");
 
41
    QTest::newRow("larger major version") << QString("24");
 
42
    QTest::newRow("major.minor") << QString("2.9");
 
43
    QTest::newRow("major.minor.patch") << QString("12.3.2");
 
44
}
 
45
 
 
46
void CMakeParserUtilsTest::invalidVersionsTest()
 
47
{
 
48
    bool ok = true;
 
49
    QList<int> versions;
 
50
    QFETCH(QString, version);
 
51
    versions = CMakeParserUtils::parseVersion(version, &ok);
 
52
    QVERIFY(ok == false);
 
53
    QVERIFY(versions.count() == 0);
 
54
}
 
55
 
 
56
void CMakeParserUtilsTest::invalidVersionsTest_data()
 
57
{
 
58
    QTest::addColumn<QString>("version");
 
59
    QTest::newRow("letter version") << QString("A");
 
60
    QTest::newRow("major.minor") << QString("A.B");
 
61
    QTest::newRow("major.minor.patch") << QString("AA.B.C");
 
62
}
 
63
 
 
64
 
 
65
#include "cmakeparserutilstest.moc"