28
28
#include < iostream>
29
29
#include < sstream>
30
30
31
+ #include " Corrade/Containers/Optional.h"
31
32
#include " Corrade/TestSuite/Tester.h"
32
33
33
34
namespace Corrade { namespace TestSuite {
@@ -425,6 +426,7 @@ struct TesterTest: Tester {
425
426
void compareNoCommonType ();
426
427
void compareAsOverload ();
427
428
void compareAsVarargs ();
429
+ void compareWithDereference ();
428
430
void compareNonCopyable ();
429
431
void verifyExplicitBool ();
430
432
void expectFailIfExplicitBool ();
@@ -462,6 +464,7 @@ TesterTest::TesterTest() {
462
464
&TesterTest::compareNoCommonType,
463
465
&TesterTest::compareAsOverload,
464
466
&TesterTest::compareAsVarargs,
467
+ &TesterTest::compareWithDereference,
465
468
&TesterTest::compareNonCopyable,
466
469
&TesterTest::verifyExplicitBool,
467
470
&TesterTest::expectFailIfExplicitBool});
@@ -496,30 +499,30 @@ void TesterTest::test() {
496
499
" Starting TesterTest::Test with 40 test cases...\n "
497
500
" ? [01] <unknown>()\n "
498
501
" OK [02] trueExpression()\n "
499
- " FAIL [03] falseExpression() at here.cpp on line 196 \n "
502
+ " FAIL [03] falseExpression() at here.cpp on line 197 \n "
500
503
" Expression 5 != 5 failed.\n "
501
504
" OK [04] equal()\n "
502
- " FAIL [05] nonEqual() at here.cpp on line 206 \n "
505
+ " FAIL [05] nonEqual() at here.cpp on line 207 \n "
503
506
" Values a and b are not the same, actual is\n "
504
507
" 5\n "
505
508
" but expected\n "
506
509
" 3\n "
507
- " XFAIL [06] expectFail() at here.cpp on line 212\n "
508
- " The world is not mad yet. 2 + 2 and 5 failed the comparison.\n "
509
510
" XFAIL [06] expectFail() at here.cpp on line 213\n "
511
+ " The world is not mad yet. 2 + 2 and 5 failed the comparison.\n "
512
+ " XFAIL [06] expectFail() at here.cpp on line 214\n "
510
513
" The world is not mad yet. Expression false == true failed.\n "
511
514
" OK [06] expectFail()\n "
512
- " XPASS [07] unexpectedPassExpression() at here.cpp on line 226 \n "
515
+ " XPASS [07] unexpectedPassExpression() at here.cpp on line 227 \n "
513
516
" Expression true == true was expected to fail.\n "
514
- " XPASS [08] unexpectedPassEqual() at here.cpp on line 231 \n "
517
+ " XPASS [08] unexpectedPassEqual() at here.cpp on line 232 \n "
515
518
" 2 + 2 and 4 were expected to fail the comparison.\n "
516
519
" OK [09] compareAs()\n "
517
- " FAIL [10] compareAsFail() at here.cpp on line 239 \n "
520
+ " FAIL [10] compareAsFail() at here.cpp on line 240 \n "
518
521
" Length of actual \" meh\" doesn't match length of expected \" hello\" with epsilon 0\n "
519
522
" OK [11] compareWith()\n "
520
- " FAIL [12] compareWithFail() at here.cpp on line 247 \n "
523
+ " FAIL [12] compareWithFail() at here.cpp on line 248 \n "
521
524
" Length of actual \" You rather GTFO\" doesn't match length of expected \" hello\" with epsilon 9\n "
522
- " FAIL [13] compareImplicitConversionFail() at here.cpp on line 252 \n "
525
+ " FAIL [13] compareImplicitConversionFail() at here.cpp on line 253 \n "
523
526
" Values \" holla\" and hello are not the same, actual is\n "
524
527
" holla\n "
525
528
" but expected\n "
@@ -536,7 +539,7 @@ void TesterTest::test() {
536
539
" [19] tearing down...\n "
537
540
" ? [19] <unknown>()\n "
538
541
" [20] setting up...\n "
539
- " FAIL [20] setupTeardownFail() at here.cpp on line 289 \n "
542
+ " FAIL [20] setupTeardownFail() at here.cpp on line 290 \n "
540
543
" Expression false failed.\n "
541
544
" [20] tearing down...\n "
542
545
" [21] setting up...\n "
@@ -545,7 +548,7 @@ void TesterTest::test() {
545
548
" [21] tearing down...\n "
546
549
" OK [22] instancedTest(zero)\n "
547
550
" OK [23] instancedTest(1)\n "
548
- " FAIL [24] instancedTest(two) at here.cpp on line 312 \n "
551
+ " FAIL [24] instancedTest(two) at here.cpp on line 313 \n "
549
552
" Values data.value*data.value*data.value and data.result are not the same, actual is\n "
550
553
" 125\n "
551
554
" but expected\n "
@@ -559,7 +562,7 @@ void TesterTest::test() {
559
562
" 4\n "
560
563
" OK [27] repeatedTest()@5\n "
561
564
" ? [28] <unknown>()@50\n "
562
- " FAIL [29] repeatedTestFail()@18 at here.cpp on line 323 \n "
565
+ " FAIL [29] repeatedTestFail()@18 at here.cpp on line 324 \n "
563
566
" Expression _i++ < 17 failed.\n "
564
567
" SKIP [30] repeatedTestSkip()@29\n "
565
568
" Too late.\n "
@@ -574,7 +577,7 @@ void TesterTest::test() {
574
577
" [32] tearing down...\n "
575
578
" ? [32] <unknown>()@2\n "
576
579
" [33] setting up...\n "
577
- " FAIL [33] repeatedTestSetupTeardownFail()@1 at here.cpp on line 337 \n "
580
+ " FAIL [33] repeatedTestSetupTeardownFail()@1 at here.cpp on line 338 \n "
578
581
" Expression false failed.\n "
579
582
" [33] tearing down...\n "
580
583
" [34] setting up...\n "
@@ -847,7 +850,7 @@ void TesterTest::abortOnFail() {
847
850
" Starting TesterTest::Test with 4 test cases...\n "
848
851
" ? [01] <unknown>()\n "
849
852
" OK [02] trueExpression()\n "
850
- " FAIL [03] falseExpression() at here.cpp on line 196 \n "
853
+ " FAIL [03] falseExpression() at here.cpp on line 197 \n "
851
854
" Expression 5 != 5 failed.\n "
852
855
" Aborted TesterTest::Test after first failure out of 2 checks so far. 1 test cases didn't contain any checks!\n " ;
853
856
CORRADE_COMPARE (out.str (), expected);
@@ -871,7 +874,7 @@ void TesterTest::abortOnFailSkip() {
871
874
" SKIP [14] skip()\n "
872
875
" This testcase is skipped.\n "
873
876
" OK [02] trueExpression()\n "
874
- " FAIL [03] falseExpression() at here.cpp on line 196 \n "
877
+ " FAIL [03] falseExpression() at here.cpp on line 197 \n "
875
878
" Expression 5 != 5 failed.\n "
876
879
" Aborted TesterTest::Test after first failure out of 2 checks so far.\n " ;
877
880
CORRADE_COMPARE (out.str (), expected);
@@ -892,7 +895,7 @@ void TesterTest::noXfail() {
892
895
893
896
std::string expected =
894
897
" Starting TesterTest::Test with 1 test cases...\n "
895
- " FAIL [06] expectFail() at here.cpp on line 212 \n "
898
+ " FAIL [06] expectFail() at here.cpp on line 213 \n "
896
899
" Values 2 + 2 and 5 are not the same, actual is\n "
897
900
" 4\n "
898
901
" but expected\n "
@@ -1030,6 +1033,12 @@ void TesterTest::compareAsVarargs() {
1030
1033
CORRADE_COMPARE_AS (a, b, std::pair<int , int >);
1031
1034
}
1032
1035
1036
+ void TesterTest::compareWithDereference () {
1037
+ Containers::Optional<StringLength> comparator{Containers::InPlaceInit};
1038
+
1039
+ CORRADE_COMPARE_WITH (" hello" , " olleh" , *comparator);
1040
+ }
1041
+
1033
1042
struct NonCopyable {
1034
1043
explicit NonCopyable () = default;
1035
1044
NonCopyable (const NonCopyable&) = delete ;
0 commit comments