mirror of
https://github.com/QuasarApp/qca.git
synced 2025-05-13 02:59:34 +00:00
Move the KeyLength unit tests to QTestLib and link
them into the test framework. This is a very trivial test, but it already exists and I wanted to clean up the left-over tests. svn path=/trunk/kdesupport/qca/; revision=522582
This commit is contained in:
parent
bbcf869809
commit
91f937adbd
unittest
@ -8,6 +8,7 @@ cd hashunittest && make check && cd .. && \
|
||||
cd hexunittest && make check && cd .. && \
|
||||
cd kdfunittest && make check && cd .. && \
|
||||
cd keygenunittest && make check && cd .. && \
|
||||
cd keylengthunittest && make check && cd .. && \
|
||||
cd macunittest && make check && cd .. && \
|
||||
cd pkits && make check && cd .. && \
|
||||
cd securearrayunittest && make check && cd .. && \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
|
||||
* 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
|
||||
@ -27,30 +27,35 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
KeyLengthUnitTest::KeyLengthUnitTest()
|
||||
: Tester()
|
||||
void KeyLengthUnitTest::initTestCase()
|
||||
{
|
||||
|
||||
m_init = new QCA::Initializer;
|
||||
#include "../fixpaths.include"
|
||||
}
|
||||
|
||||
void KeyLengthUnitTest::allTests()
|
||||
void KeyLengthUnitTest::cleanupTestCase()
|
||||
{
|
||||
QCA::Initializer init;
|
||||
QCA::unloadAllPlugins();
|
||||
delete m_init;
|
||||
}
|
||||
|
||||
void KeyLengthUnitTest::doTest()
|
||||
{
|
||||
QCA::KeyLength keylen1( 0, 0, 0 );
|
||||
CHECK( keylen1.minimum(), 0 );
|
||||
CHECK( keylen1.maximum(), 0 );
|
||||
CHECK( keylen1.multiple(), 0 );
|
||||
QCOMPARE( keylen1.minimum(), 0 );
|
||||
QCOMPARE( keylen1.maximum(), 0 );
|
||||
QCOMPARE( keylen1.multiple(), 0 );
|
||||
|
||||
QCA::KeyLength keylen2( 3, 40, 1 );
|
||||
CHECK( keylen2.minimum(), 3 );
|
||||
CHECK( keylen2.maximum(), 40 );
|
||||
CHECK( keylen2.multiple(), 1 );
|
||||
QCOMPARE( keylen2.minimum(), 3 );
|
||||
QCOMPARE( keylen2.maximum(), 40 );
|
||||
QCOMPARE( keylen2.multiple(), 1 );
|
||||
|
||||
QCA::KeyLength keylen3( 1, INT_MAX, 1 );
|
||||
CHECK( keylen3.minimum(), 1 );
|
||||
CHECK( keylen3.maximum(), INT_MAX );
|
||||
CHECK( keylen3.multiple(), 1 );
|
||||
QCOMPARE( keylen3.minimum(), 1 );
|
||||
QCOMPARE( keylen3.maximum(), INT_MAX );
|
||||
QCOMPARE( keylen3.multiple(), 1 );
|
||||
|
||||
}
|
||||
|
||||
QTEST_MAIN(KeyLengthUnitTest)
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
|
||||
* 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
|
||||
@ -25,15 +25,19 @@
|
||||
#ifndef KEYLENGTHUNITTEST_H
|
||||
#define KEYLENGTHUNITTEST_H
|
||||
|
||||
#include "tester.h"
|
||||
#include <QtCrypto>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class KeyLengthUnitTest : public Tester
|
||||
class KeyLengthUnitTest : public QObject
|
||||
{
|
||||
public:
|
||||
KeyLengthUnitTest();
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void allTests();
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void doTest();
|
||||
private:
|
||||
QCA::Initializer* m_init;
|
||||
};
|
||||
|
||||
#endif
|
16
unittest/keylengthunittest/keylengthunittest.pro
Normal file
16
unittest/keylengthunittest/keylengthunittest.pro
Normal file
@ -0,0 +1,16 @@
|
||||
TEMPLATE = app
|
||||
TARGET = keylengthunittest
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += ../../include/QtCrypto
|
||||
LIBS += -L../../lib -lqca
|
||||
CONFIG += qtestlib thread console
|
||||
QT -= gui
|
||||
|
||||
# check target
|
||||
QMAKE_EXTRA_TARGETS = check
|
||||
check.depends = keylengthunittest
|
||||
check.commands = ./keylengthunittest
|
||||
|
||||
# Input
|
||||
HEADERS += keylengthunittest.h
|
||||
SOURCES += keylengthunittest.cpp
|
@ -9,6 +9,7 @@ SUBDIRS += \
|
||||
hexunittest \
|
||||
kdfunittest \
|
||||
keygenunittest \
|
||||
keylengthunittest \
|
||||
macunittest \
|
||||
pkits \
|
||||
securearrayunittest \
|
||||
|
Loading…
x
Reference in New Issue
Block a user