diff options
| author | Phil Nash | 2011-03-09 19:45:05 +0000 |
|---|---|---|
| committer | Phil Nash | 2011-03-09 19:45:05 +0000 |
| commit | b708789ee9aa5888e104adbcaa7048b2432eaf9b (patch) | |
| tree | 73433c986e8ab35ac50359867b3b3555f5808c15 /Test/ConditionTests.cpp | |
| parent | c57ff75cdb9841aaf9a4e14b98eabe9e4584d564 (diff) | |
| download | catch3-b708789ee9aa5888e104adbcaa7048b2432eaf9b.tar.gz | |
First cut of single-evaluation fix
Diffstat (limited to 'Test/ConditionTests.cpp')
| -rw-r--r-- | Test/ConditionTests.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Test/ConditionTests.cpp b/Test/ConditionTests.cpp index f7247f89..b1010169 100644 --- a/Test/ConditionTests.cpp +++ b/Test/ConditionTests.cpp @@ -153,6 +153,33 @@ TEST_CASE( "./failing/conditions/ordered", "Ordering comparison checks that shou CHECK( data.str_hello <= "a" ); } +// Comparisons with int literals +TEST_CASE( "./succeeding/conditions/int literals", "Comparisons with int literals don't warn when mixing signed/ unsigned" ) +{ + int i = 1; + unsigned int ui = 2; + long l = 3; + unsigned long ul = 4; + char c = 5; + unsigned char uc = 6; + + REQUIRE( i == 1 ); + REQUIRE( ui == 2 ); + REQUIRE( l == 3 ); + REQUIRE( ul == 4 ); + REQUIRE( c == 5 ); + REQUIRE( uc == 6 ); + + REQUIRE( 1 == i ); + REQUIRE( 2 == ui ); + REQUIRE( 3 == l ); + REQUIRE( 4 == ul ); + REQUIRE( 5 == c ); + REQUIRE( 6 == uc ); + + REQUIRE( 62270208023445 > ul ); +} + // Not (!) tests // The problem with the ! operator is that it has right-to-left associativity. // This means we can't isolate it when we decompose. The simple REQUIRE( !false ) form, therefore, |