| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/testlib/qtestelementattribute.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtTest module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
| 9 | ** Commercial License Usage | - | ||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||
| 16 | ** | - | ||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
| 25 | ** | - | ||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
| 29 | ** | - | ||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||
| 31 | ** | - | ||||||
| 32 | ****************************************************************************/ | - | ||||||
| 33 | - | |||||||
| 34 | #include <QtTest/private/qtestelementattribute_p.h> | - | ||||||
| 35 | #include <QtCore/qbytearray.h> | - | ||||||
| 36 | #include <string.h> | - | ||||||
| 37 | #include <stdlib.h> | - | ||||||
| 38 | - | |||||||
| 39 | QT_BEGIN_NAMESPACE | - | ||||||
| 40 | - | |||||||
| 41 | /*! \enum QTest::AttributeIndex | - | ||||||
| 42 | This enum numbers the different tests. | - | ||||||
| 43 | - | |||||||
| 44 | \value AI_Undefined | - | ||||||
| 45 | - | |||||||
| 46 | \value AI_Name | - | ||||||
| 47 | - | |||||||
| 48 | \value AI_Result | - | ||||||
| 49 | - | |||||||
| 50 | \value AI_Tests | - | ||||||
| 51 | - | |||||||
| 52 | \value AI_Failures | - | ||||||
| 53 | - | |||||||
| 54 | \value AI_Errors | - | ||||||
| 55 | - | |||||||
| 56 | \value AI_Type | - | ||||||
| 57 | - | |||||||
| 58 | \value AI_Description | - | ||||||
| 59 | - | |||||||
| 60 | \value AI_PropertyValue | - | ||||||
| 61 | - | |||||||
| 62 | \value AI_QTestVersion | - | ||||||
| 63 | - | |||||||
| 64 | \value AI_QtVersion | - | ||||||
| 65 | - | |||||||
| 66 | \value AI_File | - | ||||||
| 67 | - | |||||||
| 68 | \value AI_Line | - | ||||||
| 69 | - | |||||||
| 70 | \value AI_Metric | - | ||||||
| 71 | - | |||||||
| 72 | \value AI_Tag | - | ||||||
| 73 | - | |||||||
| 74 | \value AI_Value | - | ||||||
| 75 | - | |||||||
| 76 | \value AI_Iterations | - | ||||||
| 77 | */ | - | ||||||
| 78 | - | |||||||
| 79 | /*! \enum QTest::LogElementType | - | ||||||
| 80 | The enum specifies the kinds of test log messages. | - | ||||||
| 81 | - | |||||||
| 82 | \value LET_Undefined | - | ||||||
| 83 | - | |||||||
| 84 | \value LET_Property | - | ||||||
| 85 | - | |||||||
| 86 | \value LET_Properties | - | ||||||
| 87 | - | |||||||
| 88 | \value LET_Failure | - | ||||||
| 89 | - | |||||||
| 90 | \value LET_Error | - | ||||||
| 91 | - | |||||||
| 92 | \value LET_TestCase | - | ||||||
| 93 | - | |||||||
| 94 | \value LET_TestSuite | - | ||||||
| 95 | - | |||||||
| 96 | \value LET_Benchmark | - | ||||||
| 97 | - | |||||||
| 98 | \value LET_SystemError | - | ||||||
| 99 | */ | - | ||||||
| 100 | - | |||||||
| 101 | QTestElementAttribute::QTestElementAttribute() | - | ||||||
| 102 | :attributeValue(0), | - | ||||||
| 103 | attributeIndex(QTest::AI_Undefined) | - | ||||||
| 104 | { | - | ||||||
| 105 | } executed 88122 times by 1 test: end of blockExecuted by:
| 88122 | ||||||
| 106 | - | |||||||
| 107 | QTestElementAttribute::~QTestElementAttribute() | - | ||||||
| 108 | { | - | ||||||
| 109 | delete[] attributeValue; | - | ||||||
| 110 | } executed 88122 times by 1 test: end of blockExecuted by:
| 88122 | ||||||
| 111 | - | |||||||
| 112 | const char *QTestElementAttribute::value() const | - | ||||||
| 113 | { | - | ||||||
| 114 | return attributeValue; executed 54287 times by 1 test: return attributeValue;Executed by:
| 54287 | ||||||
| 115 | } | - | ||||||
| 116 | - | |||||||
| 117 | const char *QTestElementAttribute::name() const | - | ||||||
| 118 | { | - | ||||||
| 119 | const char *AttributeNames[] = | - | ||||||
| 120 | { | - | ||||||
| 121 | "name", | - | ||||||
| 122 | "result", | - | ||||||
| 123 | "tests", | - | ||||||
| 124 | "failures", | - | ||||||
| 125 | "errors", | - | ||||||
| 126 | "type", | - | ||||||
| 127 | "description", | - | ||||||
| 128 | "value", | - | ||||||
| 129 | "qtestversion", | - | ||||||
| 130 | "qtversion", | - | ||||||
| 131 | "file", | - | ||||||
| 132 | "line", | - | ||||||
| 133 | "metric", | - | ||||||
| 134 | "tag", | - | ||||||
| 135 | "value", | - | ||||||
| 136 | "iterations" | - | ||||||
| 137 | }; | - | ||||||
| 138 | - | |||||||
| 139 | if (attributeIndex != QTest::AI_Undefined)
| 0-22085 | ||||||
| 140 | return AttributeNames[attributeIndex]; executed 22085 times by 1 test: return AttributeNames[attributeIndex];Executed by:
| 22085 | ||||||
| 141 | - | |||||||
| 142 | return 0; never executed: return 0; | 0 | ||||||
| 143 | } | - | ||||||
| 144 | - | |||||||
| 145 | QTest::AttributeIndex QTestElementAttribute::index() const | - | ||||||
| 146 | { | - | ||||||
| 147 | return attributeIndex; executed 205854 times by 1 test: return attributeIndex;Executed by:
| 205854 | ||||||
| 148 | } | - | ||||||
| 149 | - | |||||||
| 150 | bool QTestElementAttribute::isNull() const | - | ||||||
| 151 | { | - | ||||||
| 152 | return attributeIndex == QTest::AI_Undefined; never executed: return attributeIndex == QTest::AI_Undefined; | 0 | ||||||
| 153 | } | - | ||||||
| 154 | - | |||||||
| 155 | bool QTestElementAttribute::setPair(QTest::AttributeIndex index, const char *value) | - | ||||||
| 156 | { | - | ||||||
| 157 | if (!value)
| 0-88529 | ||||||
| 158 | return false; never executed: return false; | 0 | ||||||
| 159 | - | |||||||
| 160 | delete[] attributeValue; | - | ||||||
| 161 | - | |||||||
| 162 | attributeIndex = index; | - | ||||||
| 163 | attributeValue = qstrdup(value); | - | ||||||
| 164 | - | |||||||
| 165 | return attributeValue != 0; executed 88529 times by 1 test: return attributeValue != 0;Executed by:
| 88529 | ||||||
| 166 | } | - | ||||||
| 167 | - | |||||||
| 168 | QT_END_NAMESPACE | - | ||||||
| 169 | - | |||||||
| Source code | Switch to Preprocessed file |