qca/unittest/staticunittest/staticunittest.cpp
Brad Hards 27c7a01f77 First round of unit tests. No special support at this stage (although
it might be nice to use Zack's kunittest - doesn't appear to have any
heavy KDE dependency) - open coded tests.

svn path=/trunk/kdesupport/qca/; revision=349851
2004-09-27 21:47:33 +00:00

30 lines
578 B
C++

#include"qca.h"
#include<stdio.h>
int main(int argc, char **argv)
{
QCA::init();
QByteArray test(10);
test.fill('a');
if (QString("61616161616161616161") == QCA::arrayToHex(test) ) {
printf ("arrayToHex passed\n");
} else {
printf ("arrayToHex FAILED\n");
printf ("expected: 61616161616161616161\n");
printf (" got: %s\n", QCA::arrayToHex(test).latin1() );
}
test.fill('b');
test[7] = 0x00;
if (QCA::hexToArray(QString("62626262626262006262") ) == test ) {
printf ("hexToArray passed\n");
} else {
printf ("hexToArray FAILED\n");
}
return 0;
}