Convert the old symmetric cipher tests to use

QTestLib. Also fixed up some problems in the test
suite.

svn path=/trunk/kdesupport/qca/; revision=498252
This commit is contained in:
Brad Hards 2006-01-15 05:17:47 +00:00
parent 3f17eb5b67
commit b15d8ae8aa
7 changed files with 2202 additions and 1545 deletions

View File

@ -1,8 +1,9 @@
export LD_LIBRARY_PATH="../../lib:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="../../lib:$LD_LIBRARY_PATH"
cd base64unittest && make check && cd .. && \
cd bigintunittest && make check && cd .. && \ cd bigintunittest && make check && cd .. && \
cd cipherunittest && make check && cd .. && \
cd hashunittest && make check && cd .. && \ cd hashunittest && make check && cd .. && \
cd hexunittest && make check && cd .. && \ cd hexunittest && make check && cd .. && \
cd base64unittest && make check && cd .. && \
cd kdfunittest && make check && cd .. && \ cd kdfunittest && make check && cd .. && \
cd securearrayunittest && make check && cd .. && \ cd securearrayunittest && make check && cd .. && \
cd staticunittest && make check && cd .. cd staticunittest && make check && cd ..

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
/**
* Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CIPHERUNITTEST_H
#define CIPHERUNITTEST_H
#include "tester.h"
class CipherUnitTest : public Tester
{
public:
CipherUnitTest();
public:
void allTests();
private:
void aes128Tests();
void aes192Tests();
void aes256Tests();
void tripleDESTests();
void DESTests();
void blowfishTests();
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,97 @@
/**
* Copyright (C) 2004-2006 Brad Hards <bradh@frogmouth.net>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CIPHERUNITTEST_H
#define CIPHERUNITTEST_H
#include <QtCrypto>
#include <QtTest/QtTest>
class CipherUnitTest : public QObject
{
Q_OBJECT
private slots:
void initTestCase();
void cleanupTestCase();
void aes128_data();
void aes128();
void aes128_cbc_data();
void aes128_cbc();
void aes128_cfb_data();
void aes128_cfb();
void aes128_ofb_data();
void aes128_ofb();
void aes192_data();
void aes192();
void aes192_cbc_data();
void aes192_cbc();
void aes192_cfb_data();
void aes192_cfb();
void aes192_ofb_data();
void aes192_ofb();
void aes256_data();
void aes256();
void aes256_cbc_data();
void aes256_cbc();
void aes256_cfb_data();
void aes256_cfb();
void aes256_ofb_data();
void aes256_ofb();
void tripleDES_data();
void tripleDES();
void des_data();
void des();
void des_pkcs7_data();
void des_pkcs7();
void des_cbc_data();
void des_cbc();
void des_cbc_pkcs7_data();
void des_cbc_pkcs7();
void des_cfb_data();
void des_cfb();
void des_ofb_data();
void des_ofb();
void blowfish_data();
void blowfish();
void blowfish_cbc_data();
void blowfish_cbc();
void blowfish_cbc_pkcs7_data();
void blowfish_cbc_pkcs7();
void blowfish_cfb_data();
void blowfish_cfb();
void blowfish_ofb_data();
void blowfish_ofb();
private:
QCA::Initializer* m_init;
};
#endif

View File

@ -0,0 +1,16 @@
TEMPLATE = app
TARGET = cipherunittest
DEPENDPATH += .
INCLUDEPATH += ../../include/QtCrypto
LIBS += -L../../lib -lqca
CONFIG += qtestlib thread console
QT -= gui
# check target
QMAKE_EXTRA_TARGETS = check
check.depends = cipherunittest
check.commands = ./cipherunittest
# Input
HEADERS += cipherunittest.h
SOURCES += cipherunittest.cpp

View File

@ -3,7 +3,8 @@ TEMPLATE = subdirs
SUBDIRS += \ SUBDIRS += \
base64unittest \ base64unittest \
bigintunittest \ bigintunittest \
hashunittest \ cipherunittest \
hashunittest \
hexunittest \ hexunittest \
kdfunittest \ kdfunittest \
keygenunittest \ keygenunittest \