Skip to content

Commit

Permalink
tst_QFlags: test comparison against literal zero
Browse files Browse the repository at this point in the history
Pick-to: 6.8
Change-Id: Ibae36f9a7eeca946408ffffd041fc9629fc9a8ac
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
  • Loading branch information
thiagomacieira committed Oct 9, 2024
1 parent c377f4e commit 7ad855e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/auto/corelib/global/qflags/tst_qflags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ private slots:
void construction() const;
void boolCasts() const;
void operators() const;
void compareToZero() const;
void mixingDifferentEnums() const;
void testFlag() const;
void testFlagZeroFlag() const;
Expand Down Expand Up @@ -150,6 +151,21 @@ void tst_QFlags::operators() const
#undef CHECK
}

void tst_QFlags::compareToZero() const
{
SignedFlags sf;
UnsignedFlags uf;
// Don't change these to QT_TEST_EQUALITY_OPS
QVERIFY(sf == 0);
QVERIFY(0 == sf);
QVERIFY(!(sf != 0));
QVERIFY(!(0 != sf));
QVERIFY(uf == 0);
QVERIFY(0 == uf);
QVERIFY(!(uf != 0));
QVERIFY(!(0 != uf));
}

void tst_QFlags::mixingDifferentEnums() const
{
#define CHECK(op, LHS, RHS, RES) \
Expand Down

0 comments on commit 7ad855e

Please sign in to comment.