Mercurial > trustbridge
comparison ui/tests/cinstprocesstest.cpp @ 115:5ed770c41a73
Change garbage input to invalid input. Fix InvalidInstructions test.
InvalidInstructions test now fails as instruction validation is not yet implemented
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 21 Mar 2014 16:33:18 +0000 |
parents | 8fa273791242 |
children | f5fa39347366 |
comparison
equal
deleted
inserted
replaced
114:447a7abee6c7 | 115:5ed770c41a73 |
---|---|
75 for (int i = 0; i < 1030; i++) { | 75 for (int i = 0; i < 1030; i++) { |
76 garbage[i] = (char) qrand() % 255; | 76 garbage[i] = (char) qrand() % 255; |
77 } | 77 } |
78 retval = installerProcess->write(garbage, 1030); | 78 retval = installerProcess->write(garbage, 1030); |
79 bytesWritten += retval; | 79 bytesWritten += retval; |
80 } while (retval != -1 && bytesWritten < 100 *1024 *1024 ); | 80 } while (retval != -1 && bytesWritten < 15 *1024 *1024 ); |
81 | 81 |
82 QVERIFY (bytesWritten < 100 *1024 *1024); | 82 finishVerify(installerProcess, ERR_INVALID_INPUT); |
83 | |
84 finishVerify(installerProcess, ERR_TOO_MUCH_INPUT); | |
85 } | 83 } |
86 | 84 |
87 void CinstProcessTest::testNoInput() { | 85 void CinstProcessTest::testNoInput() { |
88 QProcess* installerProcess = startCinstProcess(); | 86 QProcess* installerProcess = startCinstProcess(); |
89 QVERIFY(installerProcess->state() == QProcess::Running); | 87 QVERIFY(installerProcess->state() == QProcess::Running); |
107 | 105 |
108 void CinstProcessTest::testInvalidInstruction() { | 106 void CinstProcessTest::testInvalidInstruction() { |
109 QProcess* installerProcess = startCinstProcess(); | 107 QProcess* installerProcess = startCinstProcess(); |
110 QVERIFY(installerProcess->state() == QProcess::Running); | 108 QVERIFY(installerProcess->state() == QProcess::Running); |
111 | 109 |
112 /* foobar as instruction */ | 110 /* I: as instruction */ |
113 installerProcess->write("-----BEGIN CERTIFICATE LIST-----\r\n"); | 111 installerProcess->write("-----BEGIN CERTIFICATE LIST-----\r\n"); |
114 installerProcess->write(validList.rawData().toLatin1()); | 112 installerProcess->write(validList.rawData().toLatin1()); |
115 installerProcess->write("-----END CERTIFICATE LIST-----\r\n"); | 113 installerProcess->write("-----END CERTIFICATE LIST-----\r\n"); |
116 | 114 |
117 installerProcess->write("foobar"); | 115 installerProcess->write("I:ABCDEF"); |
118 | 116 |
119 finishVerify(installerProcess, ERR_INVALID_INSTRUCTIONS); | 117 finishVerify(installerProcess, ERR_INVALID_INSTRUCTIONS); |
120 } | 118 } |
121 | 119 |
122 QTEST_GUILESS_MAIN (CinstProcessTest); | 120 QTEST_GUILESS_MAIN (CinstProcessTest); |