mirror of
https://github.com/QuasarApp/qca.git
synced 2025-05-14 19:39:33 +00:00
Merge the declaration into the .cpp, and update
qmake buildsystem to match. Add CMake support. svn path=/trunk/kdesupport/qca/; revision=594724
This commit is contained in:
parent
2ec5c1e2b5
commit
65f3bc30b0
unittest/keygenunittest
9
unittest/keygenunittest/CMakeLists.txt
Normal file
9
unittest/keygenunittest/CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
set( keygenunittest_bin_SRCS keygenunittest.cpp)
|
||||
|
||||
MY_AUTOMOC( keygenunittest_bin_SRCS )
|
||||
|
||||
add_executable( keygenunittest ${keygenunittest_bin_SRCS} )
|
||||
|
||||
target_link_libraries( keygenunittest qca ${QT_QTTEST_LIBRARY})
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright (C) 2004-2005 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
|
||||
@ -22,8 +22,23 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "keygenunittest.h"
|
||||
|
||||
#include <QtCrypto>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class KeyGenUnitTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void testRSA();
|
||||
void testDSA();
|
||||
void testDH();
|
||||
private:
|
||||
QCA::Initializer* m_init;
|
||||
};
|
||||
|
||||
void KeyGenUnitTest::initTestCase()
|
||||
{
|
||||
@ -53,13 +68,13 @@ void KeyGenUnitTest::testRSA()
|
||||
QCOMPARE( rsa1.isNull(), false );
|
||||
QCOMPARE( rsa1.e(), QBigInteger(65537) );
|
||||
QCOMPARE( rsa1.bitSize(), 1024);
|
||||
|
||||
|
||||
priv1 = keygen.createRSA( 512, 17 );
|
||||
rsa1 = priv1.toRSA();
|
||||
QCOMPARE( rsa1.isNull(), false );
|
||||
QCOMPARE( rsa1.e(), QBigInteger(17) );
|
||||
QCOMPARE( rsa1.bitSize(), 512);
|
||||
|
||||
|
||||
priv1 = keygen.createRSA( 512, 3 );
|
||||
rsa1 = priv1.toRSA();
|
||||
QCOMPARE( rsa1.isNull(), false );
|
||||
@ -83,13 +98,13 @@ void KeyGenUnitTest::testDSA()
|
||||
QCA::DSAPrivateKey dsa1 = priv2.toDSA();
|
||||
QCOMPARE( dsa1.isNull(), false );
|
||||
QCOMPARE( dsa1.bitSize(), 512 );
|
||||
|
||||
|
||||
group = keygen.createDLGroup( QCA::DSA_768 );
|
||||
priv2 = keygen.createDSA( group );
|
||||
dsa1 = priv2.toDSA();
|
||||
QCOMPARE( dsa1.isNull(), false );
|
||||
QCOMPARE( dsa1.bitSize(), 768 );
|
||||
|
||||
|
||||
group = keygen.createDLGroup( QCA::DSA_1024 );
|
||||
priv2 = keygen.createDSA( group );
|
||||
dsa1 = priv2.toDSA();
|
||||
@ -113,7 +128,7 @@ void KeyGenUnitTest::testDH()
|
||||
QCA::DHPrivateKey dh1 = priv3.toDH();
|
||||
QCOMPARE( dh1.isNull(), false );
|
||||
QCOMPARE( dh1.bitSize(), 1024 );
|
||||
|
||||
|
||||
group = keygen.createDLGroup( QCA::IETF_2048 );
|
||||
priv3 = keygen.createDH( group );
|
||||
dh1 = priv3.toDH();
|
||||
@ -122,3 +137,6 @@ void KeyGenUnitTest::testDH()
|
||||
}
|
||||
|
||||
QTEST_MAIN(KeyGenUnitTest)
|
||||
|
||||
#include "keygenunittest.moc"
|
||||
|
||||
|
@ -1,45 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2004-2005 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 KEYGENUNITTEST_H
|
||||
#define KEYGENUNITTEST_H
|
||||
|
||||
#include <QtCrypto>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
class KeyGenUnitTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void testRSA();
|
||||
void testDSA();
|
||||
void testDH();
|
||||
private:
|
||||
QCA::Initializer* m_init;
|
||||
};
|
||||
|
||||
#endif
|
@ -11,5 +11,4 @@ check.depends = keygenunittest
|
||||
check.commands = ./keygenunittest
|
||||
|
||||
# Input
|
||||
HEADERS += keygenunittest.h
|
||||
SOURCES += keygenunittest.cpp
|
||||
|
Loading…
x
Reference in New Issue
Block a user