summaryrefslogtreecommitdiff
path: root/src/tests/backend/config/cbtconfig_test.cpp
blob: 81a63b62e12ceca9c1b74b2017c127cd4326b6b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*********
*
* This file is part of BibleTime's source code, http://www.bibletime.info/.
*
* Copyright 1999-2008 by the BibleTime developers.
* The BibleTime source code is licensed under the GNU General Public License version 2.0.
*
**********/

#include "tests/bibletime_test.h"

#include "backend/config/cbtconfig.h"

#include <QtTest/QtTest>


void BibleTimeTest::frontend_cbtconfig_test() {
    QList<int> value1;
    value1 << -1 << 0 << 1 << 993738;
    QString value1String("-1,0,1,993738");
    QList<int> emptyValue;
    QString emptyValueString("");

    //conversion checks int-string
    QCOMPARE(CBTConfig::IntListToString(value1), value1String);
    QCOMPARE(CBTConfig::IntListToString(emptyValue), emptyValueString);

    //conversion checks string-int
    QCOMPARE(CBTConfig::StringToIntList(value1String), value1);
    QCOMPARE(CBTConfig::StringToIntList(emptyValueString), emptyValue);

    //roundtrip checks
    QCOMPARE(CBTConfig::StringToIntList(CBTConfig::IntListToString(value1)), value1);
    QCOMPARE(CBTConfig::StringToIntList(CBTConfig::IntListToString(emptyValue)), emptyValue);
}