aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmlcppcodegen/data/comparisonTypes.qml
blob: 423cd55ed45c0858773b652cdac46b3715a202ce (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import QtQml

QtObject {
    component Variable: QtObject {
        property int value: 4
    }

    component VariableShadow: Variable {
        property string value: "1"
    }

    property Variable last: VariableShadow {}

    function find(n: int) : int {
        var found = 0
        for (var i = 0; i < n; i++) {
            if (last.value == i)
                ++found
        }
        return found;
    }

    function findStrict(n: int) : int {
        var found = 0
        for (var i = 0; i < n; i++) {
            if (last.value === i)
                ++found
        }
        return found;
    }

    function findNot(n: int) : int {
        var found = 0
        for (var i = 0; i < n; i++) {
            if (last.value != i)
                ++found
        }
        return found;
    }

    function findNotStrict(n: int) : int {
        var found = 0
        for (var i = 0; i < n; i++) {
            if (last.value !== i)
                ++found
        }
        return found;
    }

    property int found: find(3)
    property int foundStrict: findStrict(10)
    property int foundNot: findNot(3)
    property int foundNotStrict: findNotStrict(10)
}