Mercurial > trustbridge
comparison ui/tests/certlistparsertest.cpp @ 88:abc76b750ea8
Fix extended list test. Add Benchmarking again
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Thu, 20 Mar 2014 16:58:55 +0000 |
parents | be13e5e0a98f |
children | b0b1375dfd40 |
comparison
equal
deleted
inserted
replaced
87:be13e5e0a98f | 88:abc76b750ea8 |
---|---|
5 #include <QDebug> | 5 #include <QDebug> |
6 | 6 |
7 void CertListTest::testValidList() | 7 void CertListTest::testValidList() |
8 { | 8 { |
9 const char *fname = "list-valid-signed.txt"; | 9 const char *fname = "list-valid-signed.txt"; |
10 QFile validList(fname); | 10 |
11 QDir dataDir = QDir(SOURCE_DIR"/data/"); | |
12 QString fileName = dataDir.absoluteFilePath(fname); | |
13 QFile validList(fileName); | |
11 validList.open(QIODevice::ReadOnly); | 14 validList.open(QIODevice::ReadOnly); |
12 QString validData = QString::fromLatin1(validList.readAll()); | 15 QString validData = QString::fromLatin1(validList.readAll()); |
13 QStringList instLines; | 16 QStringList instLines; |
14 QStringList remoLines; | 17 QStringList remoLines; |
15 | 18 |
18 QVERIFY(certList->isValid()); | 21 QVERIFY(certList->isValid()); |
19 | 22 |
20 QVERIFY(certList->rawData() == validData.toLatin1()); | 23 QVERIFY(certList->rawData() == validData.toLatin1()); |
21 | 24 |
22 const QList<Certificate> instList = certList->getInstallCertificates(); | 25 const QList<Certificate> instList = certList->getInstallCertificates(); |
23 const QList<Certificate> remoList = certList->getInstallCertificates(); | 26 const QList<Certificate> remoList = certList->getRemoveCertificates(); |
24 | 27 |
25 foreach (QString act, validData.split("\r\n")) { | 28 foreach (QString act, validData.split("\r\n")) { |
26 if (act.startsWith("I:")) { | 29 if (act.startsWith("I:")) { |
27 instLines << act; | 30 instLines << act; |
28 continue; | 31 continue; |
112 | 115 |
113 void CertListTest::benchmarkValid() | 116 void CertListTest::benchmarkValid() |
114 { | 117 { |
115 const char *fname = "list-valid-signed.txt"; | 118 const char *fname = "list-valid-signed.txt"; |
116 | 119 |
117 QBENCHMARK_ONCE { | 120 QBENCHMARK{ |
118 CertificateList *certList = testWithFile(fname); | 121 CertificateList *certList = testWithFile(fname); |
119 delete certList; | 122 delete certList; |
120 } | 123 } |
121 } | 124 } |
122 | 125 |