| 3149 | } |
| 3150 | |
| 3151 | void TestValidator::testValidatorMax_data() |
| 3152 | { |
| 3153 | QTest::addColumn<QString>("url"); |
| 3154 | QTest::addColumn<QByteArray>("body"); |
| 3155 | QTest::addColumn<QByteArray>("output"); |
| 3156 | |
| 3157 | // **** Start testing ValidatorMax ***** |
| 3158 | |
| 3159 | QUrlQuery query; |
| 3160 | query.addQueryItem(u"type"_s, u"sint"_s); |
| 3161 | query.addQueryItem(u"field"_s, u"%20"_s); |
| 3162 | QTest::newRow("sint-empty") << u"/max"_s << query.toString(QUrl::FullyEncoded).toLatin1() |
| 3163 | << valid; |
| 3164 | |
| 3165 | query.clear(); |
| 3166 | query.addQueryItem(u"type"_s, u"sint"_s); |
| 3167 | query.addQueryItem(u"field"_s, u"-5"_s); |
| 3168 | QTest::newRow("sint-valid") << u"/max"_s << query.toString(QUrl::FullyEncoded).toLatin1() |
| 3169 | << valid; |
| 3170 | |
| 3171 | query.clear(); |
| 3172 | query.addQueryItem(u"type"_s, u"sint"_s); |
| 3173 | query.addQueryItem(u"field"_s, u"15"_s); |
| 3174 | QTest::newRow("sint-invalid") << u"/max"_s << query.toString(QUrl::FullyEncoded).toLatin1() |
| 3175 | << invalid; |
| 3176 | |
| 3177 | query.clear(); |
| 3178 | query.addQueryItem(u"type"_s, u"uint"_s); |
| 3179 | query.addQueryItem(u"field"_s, u"5"_s); |
| 3180 | QTest::newRow("uint-valid") << u"/max"_s << query.toString(QUrl::FullyEncoded).toLatin1() |
| 3181 | << valid; |
| 3182 | |
| 3183 | query.clear(); |
| 3184 | query.addQueryItem(u"type"_s, u"uint"_s); |
| 3185 | query.addQueryItem(u"field"_s, u"15"_s); |
| 3186 | QTest::newRow("uint-invalid") << u"/max"_s << query.toString(QUrl::FullyEncoded).toLatin1() |
| 3187 | << invalid; |
| 3188 | |
| 3189 | query.clear(); |
| 3190 | query.addQueryItem(u"type"_s, u"float"_s); |
| 3191 | query.addQueryItem(u"field"_s, u"-5.234652435"_s); |
| 3192 | QTest::newRow("uint-valid") << u"/max"_s << query.toString(QUrl::FullyEncoded).toLatin1() |
| 3193 | << valid; |
| 3194 | |
| 3195 | query.clear(); |
| 3196 | query.addQueryItem(u"type"_s, u"float"_s); |
| 3197 | query.addQueryItem(u"field"_s, u"15.912037"_s); |
| 3198 | QTest::newRow("uint-invalid") << u"/max"_s << query.toString(QUrl::FullyEncoded).toLatin1() |
| 3199 | << invalid; |
| 3200 | |
| 3201 | query.clear(); |
| 3202 | query.addQueryItem(u"type"_s, u"string"_s); |
| 3203 | query.addQueryItem(u"field"_s, u"abcdefghij"_s); |
| 3204 | QTest::newRow("uint-valid") << u"/max"_s << query.toString(QUrl::FullyEncoded).toLatin1() |
| 3205 | << valid; |
| 3206 | |
| 3207 | query.clear(); |
| 3208 | query.addQueryItem(u"type"_s, u"string"_s); |