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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "QCMakePresetTest.h"
#include <utility>
#include "QCMakePreset.h"
#include <QtTest>
namespace {
QCMakePreset makePreset()
{
return QCMakePreset{
/*name=*/"name",
/*displayName=*/"displayName",
/*description=*/"description",
/*generator=*/"generator",
/*architecture=*/"architecture",
/*setArchitecture=*/true,
/*toolset=*/"toolset",
/*setToolset=*/true,
/*enabled=*/true,
};
}
template <typename T, typename U>
QCMakePreset makePreset(T QCMakePreset::*field, U&& value)
{
auto preset = makePreset();
preset.*field = std::forward<U>(value);
return preset;
}
}
void QCMakePresetTest::equality()
{
QFETCH(QCMakePreset, rhs);
QFETCH(bool, equal);
QFETCH(bool, lt);
QFETCH(bool, gt);
auto lhs = makePreset();
QVERIFY((lhs == rhs) == equal);
QVERIFY((lhs != rhs) == !equal);
QVERIFY((lhs < rhs) == lt);
QVERIFY((lhs >= rhs) == !lt);
QVERIFY((lhs > rhs) == gt);
QVERIFY((lhs <= rhs) == !gt);
}
void QCMakePresetTest::equality_data()
{
QTest::addColumn<QCMakePreset>("rhs");
QTest::addColumn<bool>("equal");
QTest::addColumn<bool>("lt");
QTest::addColumn<bool>("gt");
QTest::newRow("equal") << makePreset() << true << false << false;
QTest::newRow("name") << makePreset(&QCMakePreset::name, "other-name")
<< false << true << false;
QTest::newRow("displayName")
<< makePreset(&QCMakePreset::displayName, "other-displayName") << false
<< true << false;
QTest::newRow("description")
<< makePreset(&QCMakePreset::description, "other-description") << false
<< true << false;
QTest::newRow("generator")
<< makePreset(&QCMakePreset::generator, "other-generator") << false << true
<< false;
QTest::newRow("architecture")
<< makePreset(&QCMakePreset::architecture, "other-architecture") << false
<< true << false;
QTest::newRow("setArchitecture")
<< makePreset(&QCMakePreset::setArchitecture, false) << false << false
<< true;
QTest::newRow("toolset") << makePreset(&QCMakePreset::toolset,
"other-toolset")
<< false << false << true;
QTest::newRow("setToolset")
<< makePreset(&QCMakePreset::setToolset, false) << false << false << true;
QTest::newRow("enabled") << makePreset(&QCMakePreset::enabled, false)
<< false << false << true;
}
QTEST_MAIN(QCMakePresetTest)
|