QHash: fix key() test
The key returned by QHash::key is an arbitrary one that maps to the given value. The test instead relied on it being a specific one. Change-Id: I090351797e8b52036d78160fd810518a11e8107d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
a8ceb73b93
commit
5e24d22af0
@ -526,14 +526,14 @@ void tst_QHash::key()
|
||||
hash2.insert(3, "two");
|
||||
QCOMPARE(hash2.key("one"), 1);
|
||||
QCOMPARE(hash2.key("one", def), 1);
|
||||
QCOMPARE(hash2.key("two"), 2);
|
||||
QCOMPARE(hash2.key("two", def), 2);
|
||||
QVERIFY(hash2.key("two") == 2 || hash2.key("two") == 3);
|
||||
QVERIFY(hash2.key("two", def) == 2 || hash2.key("two", def) == 3);
|
||||
QCOMPARE(hash2.key("three"), 0);
|
||||
QCOMPARE(hash2.key("three", def), def);
|
||||
|
||||
hash2.insert(-1, "two");
|
||||
QCOMPARE(hash2.key("two"), -1);
|
||||
QCOMPARE(hash2.key("two", def), -1);
|
||||
QVERIFY(hash2.key("two") == 2 || hash2.key("two") == 3 || hash2.key("two") == -1);
|
||||
QVERIFY(hash2.key("two", def) == 2 || hash2.key("two", def) == 3 || hash2.key("two", def) == -1);
|
||||
|
||||
hash2.insert(0, "zero");
|
||||
QCOMPARE(hash2.key("zero"), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user