mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
[libcalamares] Expand tests for printable entropy
This commit is contained in:
parent
090716ba4f
commit
a11280b427
2 changed files with 28 additions and 0 deletions
|
@ -224,3 +224,30 @@ LibCalamaresTests::testPrintableEntropy()
|
|||
QVERIFY( c.cell() < 127 );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LibCalamaresTests::testOddSizedPrintable()
|
||||
{
|
||||
QString s;
|
||||
for ( int l = 0; l <= 37; ++l )
|
||||
{
|
||||
auto r = CalamaresUtils::getPrintableEntropy( l, s );
|
||||
if ( l == 0 )
|
||||
{
|
||||
QCOMPARE( r, CalamaresUtils::EntropySource::None );
|
||||
}
|
||||
else
|
||||
{
|
||||
QVERIFY( r != CalamaresUtils::EntropySource::None );
|
||||
}
|
||||
QCOMPARE( s.length(), l );
|
||||
|
||||
for ( QChar c : s )
|
||||
{
|
||||
QVERIFY( c.isPrint() );
|
||||
QCOMPARE( c.row(), 0 );
|
||||
QVERIFY( c.cell() > 32 ); // ASCII SPACE
|
||||
QVERIFY( c.cell() < 127 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ private Q_SLOTS:
|
|||
/** @brief Tests the entropy functions. */
|
||||
void testEntropy();
|
||||
void testPrintableEntropy();
|
||||
void testOddSizedPrintable();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue