MCPcopy Create free account
hub / github.com/cutelyst/cutelyst / testValidatorInteger_data

Method testValidatorInteger_data

tests/testvalidator.cpp:2859–2903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2857}
2858
2859void TestValidator::testValidatorInteger_data()
2860{
2861 QTest::addColumn<QString>("url");
2862 QTest::addColumn<QByteArray>("body");
2863 QTest::addColumn<QByteArray>("output");
2864
2865 // **** Start testing ValidatorInteger *****
2866
2867 QUrlQuery query;
2868 query.addQueryItem(u"field"_s, u"2345"_s);
2869 QTest::newRow("valid01") << u"/integer"_s << query.toString(QUrl::FullyEncoded).toLatin1()
2870 << valid;
2871
2872 query.clear();
2873 query.addQueryItem(u"field"_s, u"-2345"_s);
2874 QTest::newRow("valid02") << u"/integer"_s << query.toString(QUrl::FullyEncoded).toLatin1()
2875 << valid;
2876
2877 query.clear();
2878 query.addQueryItem(u"field"_s, QString::number(std::numeric_limits<int>::max()));
2879 QTest::newRow("valid03") << u"/integer"_s << query.toString(QUrl::FullyEncoded).toLatin1()
2880 << valid;
2881
2882 query.clear();
2883 query.addQueryItem(u"field"_s, u"-23a45 f"_s);
2884 QTest::newRow("invalid01") << u"/integer"_s << query.toString(QUrl::FullyEncoded).toLatin1()
2885 << invalid;
2886
2887 query.clear();
2888 query.addQueryItem(u"field"_s, u"a-23f45"_s);
2889 QTest::newRow("invalid02") << u"/integer"_s << query.toString(QUrl::FullyEncoded).toLatin1()
2890 << invalid;
2891
2892 query.clear();
2893 query.addQueryItem(u"field"_s, QString::number(std::numeric_limits<qlonglong>::max()));
2894 QTest::newRow("invalid03") << u"/integer"_s << query.toString(QUrl::FullyEncoded).toLatin1()
2895 << invalid;
2896
2897 query.clear();
2898 query.addQueryItem(u"field"_s, u"%20"_s);
2899 QTest::newRow("empty") << u"/integer"_s << query.toString(QUrl::FullyEncoded).toLatin1()
2900 << valid;
2901
2902 QTest::newRow("missing") << u"/integer"_s << QByteArray() << valid;
2903}
2904
2905void TestValidator::testValidatorIp_data()
2906{

Callers

nothing calls this directly

Calls 1

clearMethod · 0.80

Tested by

no test coverage detected