From f718a8a9f8feeeb44463351dbf707918c98a9b86 Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Fri, 3 Nov 2023 14:15:28 +0100 Subject: [PATCH] Use QVERIFY where apprpriate --- lib/digest.cpp | 2 +- lib/test_asn1int.cpp | 8 ++++---- lib/test_asn1time.cpp | 8 ++++---- lib/test_entropy.cpp | 8 ++++---- lib/test_x509name.cpp | 9 +-------- 5 files changed, 14 insertions(+), 21 deletions(-) diff --git a/lib/digest.cpp b/lib/digest.cpp index 28340434..5e101882 100644 --- a/lib/digest.cpp +++ b/lib/digest.cpp @@ -5,7 +5,7 @@ * All rights reserved. */ -#include "func.h" +#include "func_base.h" #include "digest.h" #include "lib/base.h" #include diff --git a/lib/test_asn1int.cpp b/lib/test_asn1int.cpp index df8c92b3..a52db12a 100644 --- a/lib/test_asn1int.cpp +++ b/lib/test_asn1int.cpp @@ -57,11 +57,11 @@ void test_asn1int::ops() a1int s(f); QCOMPARE(s, f++); QCOMPARE(++s, f); - QCOMPARE(++s != f, true); + QVERIFY(++s != f); QCOMPARE(s.getLong(), 392); QCOMPARE(f.getLong(), 391); - QCOMPARE(f < s, true); - QCOMPARE(s > f, true); + QVERIFY(f < s); + QVERIFY(s > f); QCOMPARE(QString(a1int(0x18929)), "018929"); } @@ -69,7 +69,7 @@ void test_asn1int::get() { a1int f(42); ASN1_INTEGER *g = f.get(); - QCOMPARE(g != f.get0(), true); + QVERIFY(g != f.get0()); QCOMPARE(f.get0(), f.get0()); ASN1_INTEGER_free(g); } diff --git a/lib/test_asn1time.cpp b/lib/test_asn1time.cpp index 0819cc27..c24a9ee7 100644 --- a/lib/test_asn1time.cpp +++ b/lib/test_asn1time.cpp @@ -24,10 +24,10 @@ private slots: void test_asn1time::construct_op() { a1time b, a("20191125153015Z"); - QCOMPARE(a.isValid(), true); - QCOMPARE(a.isUndefined(), false); - QCOMPARE(b == a, false); - QCOMPARE(b > a, true); + QVERIFY(a.isValid()); + QVERIFY(!a.isUndefined()); + QVERIFY(b != a); + QVERIFY(b > a); b = a; QCOMPARE(b , a); a1time c(a.get()); diff --git a/lib/test_entropy.cpp b/lib/test_entropy.cpp index e442df0d..1862489d 100644 --- a/lib/test_entropy.cpp +++ b/lib/test_entropy.cpp @@ -44,7 +44,7 @@ void test_entropy::initTestCase() void test_entropy::cleanupTestCase() { delete e; - QCOMPARE(QFileInfo::exists(rnd), true); + QVERIFY(QFileInfo::exists(rnd)); QFile::remove(rnd); qInstallMessageHandler(0); } @@ -52,7 +52,7 @@ void test_entropy::cleanupTestCase() void test_entropy::start() { e->add(17); - QCOMPARE((e->strength() > 0), true); + QVERIFY(e->strength() > 0); e->add_buf((unsigned char*)"SomeText", 8); } @@ -62,9 +62,9 @@ void test_entropy::muchSalt() QString s1, s2; for (int i=0; i<100; i++) { s1 = e->makeSalt(); - QCOMPARE(s1.contains(rx), true); + QVERIFY(s1.contains(rx)); QCOMPARE(s1.size(), 17); - QCOMPARE(s1 != s2, true); + QVERIFY(s1 != s2); s2 = s1; } } diff --git a/lib/test_x509name.cpp b/lib/test_x509name.cpp index f279f737..c5e22269 100644 --- a/lib/test_x509name.cpp +++ b/lib/test_x509name.cpp @@ -6,13 +6,6 @@ */ #include -#if 0 -#include -#include -#include -#include -#include -#endif #include "x509name.h" class test_x509name: public QObject @@ -40,7 +33,7 @@ void test_x509name::construct() x509name y; QCOMPARE(x.entryCount(), 2); QCOMPARE(y.entryCount(), 0); - QCOMPARE(x != y, true); + QVERIFY(x != y); } void test_x509name::d2i2d()