summaryrefslogtreecommitdiff
path: root/tests/auto/cryptography/tst_cryptography.cpp
blob: 16fa8fdad422204d02acbf539c3267e74d7f0c27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include <QtCore>
#include <QtTest>

#include "cryptography.h"

QT_USE_NAMESPACE_AM

class tst_Cryptography : public QObject
{
    Q_OBJECT

public:
    tst_Cryptography();

private slots:
    void random();
};

tst_Cryptography::tst_Cryptography()
{ }

void tst_Cryptography::random()
{
    QVERIFY(Cryptography::generateRandomBytes(-1).isEmpty());
    QVERIFY(Cryptography::generateRandomBytes(0).isEmpty());
    QVERIFY(!Cryptography::generateRandomBytes(1).isEmpty());
    QCOMPARE(Cryptography::generateRandomBytes(128).size(), 128);
}

QTEST_APPLESS_MAIN(tst_Cryptography)

#include "tst_cryptography.moc"