~ubuntu-branches/ubuntu/oneiric/kde4libs/oneiric-proposed

« back to all changes in this revision

Viewing changes to kioslave/tests/httpheadertokenizetest.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-07-08 00:08:34 UTC
  • mto: This revision was merged to the branch mainline in revision 247.
  • Revision ID: package-import@ubuntu.com-20110708000834-dr9a8my4iml90qe5
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
    Boston, MA 02110-1301, USA.
18
18
*/
19
19
 
 
20
#include "httpheadertokenizetest.h"
 
21
 
20
22
#include <qtest_kde.h>
21
23
 
22
24
#include <QtCore/QByteArray>
23
25
#include <QtCore/QHash>
24
 
#include <QtCore/QObject>
25
26
#include <kdebug.h>
26
27
 
27
28
#include <parsinghelpers.h>
28
29
 
29
 
#include "httpheadertokenizetest.h"
30
30
#include "httpheadertokenizetest.moc"
31
31
 
32
32
#include <parsinghelpers.cpp>
52
52
        {"last-modified", false},
53
53
        {"link", false}, //RFC 2068, multi-valued with ";" separator
54
54
        {"location", false},
55
 
*/  
 
55
*/
56
56
 
57
57
//no use testing many different headers, just a couple each of the multi-valued
58
58
//and the single-valued group to make sure that corner cases work both if there
108
108
    HeaderTokenizer tokenizer(buffer);
109
109
    int tokenizeEnd = tokenizer.tokenize(0, strlen(messyHeader));
110
110
    QCOMPARE(tokenizeEnd, (int)(strlen(messyHeader) - 1));
111
 
    
 
111
 
112
112
    // If the output of the tokenizer contains all the terms that should be there and
113
113
    // exactly the number of terms that should be there then it's exactly correct.
114
114
    // We are lax wrt trailing whitespace, by the way. It does neither explicitly matter
128
128
        foreach (const intPair &be, tokenizer.value(key).beginEnd) {
129
129
            comparisonValues.append(QByteArray(buffer + be.first, be.second - be.first));
130
130
        }
131
 
        
 
131
 
132
132
        QCOMPARE(comparisonValues.count(), values.count());
133
133
        for (int i = 0; i < values.count(); i++) {
134
134
            QVERIFY(comparisonValues[i].startsWith(values[i]));
192
192
        nValues2 += it.value().beginEnd.count();
193
193
    }
194
194
    QCOMPARE(nValues2, nValues);
 
195
 
 
196
    // Fix compiler warning
 
197
    (void)contentDispositionParser;
195
198
}