MCPcopy Create free account
hub / github.com/KDE/kdevelop / testPathComparison

Method testPathComparison

kdevplatform/util/tests/test_path.cpp:365–410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365void TestPath::testPathComparison()
366{
367 QFETCH(Path, left);
368 QFETCH(Path, right);
369 QFETCH(int, leftCompareRight);
370 QFETCH(int, leftCompareRightCi);
371
372 const bool equal = leftCompareRight == 0;
373 const bool less = leftCompareRight < 0;
374 const bool greater = leftCompareRight > 0;
375
376 QVERIFY(left == left);
377 QVERIFY(right == right);
378 QCOMPARE(left == right, equal);
379 QCOMPARE(right == left, equal);
380
381 QVERIFY(!(left != left));
382 QVERIFY(!(right != right));
383 QCOMPARE(left != right, !equal);
384 QCOMPARE(right != left, !equal);
385
386 QCOMPARE(left < right, less);
387 QCOMPARE(left <= right, less || equal);
388 QCOMPARE(left > right, greater);
389 QCOMPARE(left >= right, greater || equal);
390
391 QCOMPARE(right < left, greater);
392 QCOMPARE(right <= left, greater || equal);
393 QCOMPARE(right > left, less);
394 QCOMPARE(right >= left, less || equal);
395
396 QCOMPARE(left.compare(left), 0);
397 QCOMPARE(right.compare(right), 0);
398 QCOMPARE(left.compare(right) < 0, leftCompareRight < 0);
399 QCOMPARE(right.compare(left) < 0, leftCompareRight > 0);
400
401 QCOMPARE(left.compare(left, Qt::CaseSensitive), 0);
402 QCOMPARE(right.compare(right, Qt::CaseSensitive), 0);
403 QCOMPARE(left.compare(right, Qt::CaseSensitive) < 0, leftCompareRight < 0);
404 QCOMPARE(right.compare(left, Qt::CaseSensitive) < 0, leftCompareRight > 0);
405
406 QCOMPARE(left.compare(left, Qt::CaseInsensitive), 0);
407 QCOMPARE(right.compare(right, Qt::CaseInsensitive), 0);
408 QCOMPARE(left.compare(right, Qt::CaseInsensitive) < 0, leftCompareRightCi < 0);
409 QCOMPARE(right.compare(left, Qt::CaseInsensitive) < 0, leftCompareRightCi > 0);
410}
411
412void TestPath::testPathComparison_data()
413{

Callers

nothing calls this directly

Calls 1

compareMethod · 0.45

Tested by

no test coverage detected