Skip to content

Commit

Permalink
Fixes for MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
elB4RTO committed Feb 17, 2024
1 parent 7ce712b commit bd22bbb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions logdoctor/tests/white_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,32 @@ void testOperators()

{
const FieldData fd;
#ifdef _MSC_VER
assert( operator+(0ul, fd) == 0ul );
#else
assert( 0ul + fd == 0ul );
#endif
}{
const FieldData fd("");
#ifdef _MSC_VER
assert( operator+(0ul, fd) == 0ul );
#else
assert( 0ul + fd == 0ul );
#endif
}{
const FieldData fd("1");
#ifdef _MSC_VER
assert(operator+(0ul, fd) == 1ul );
#else
assert( 0ul + fd == 1ul );
#endif
}{
const FieldData fd("0123456789");
#ifdef _MSC_VER
assert( operator+(10ul, fd) == 20ul );
#else
assert( 10ul + fd == 20ul );
#endif
assert( fd + 10ul != 20ul ); // fd evaluates to bool (aka 1)
}{
const FieldData fd1;
Expand All @@ -112,7 +128,11 @@ void testOperators()
}{
const FieldData fd1("123");
const FieldData fd2("456");
#ifdef _MSC_VER
assert( operator+(4ul, fd1) + fd2 == 10ul );
#else
assert( 4ul + fd1 + fd2 == 10ul );
#endif
}{
const FieldData fd1("0123456789");
const FieldData fd2("0123456789");
Expand All @@ -122,7 +142,11 @@ void testOperators()
const FieldData fd1("0123456789");
const FieldData fd2("0123456789");
const FieldData fd3("0123456789");
#ifdef _MSC_VER
assert( operator+(70ul, fd1) + fd2 + fd3 == 100ul );
#else
assert( 70ul + fd1 + fd2 + fd3 == 100ul );
#endif
}{
const FieldData fd1("0123456789");
const FieldData fd2("0123456789");
Expand All @@ -132,7 +156,11 @@ void testOperators()
const FieldData fd1("0123456789");
const FieldData fd2("0123456789");
const FieldData fd3("0123456789");
#ifdef _MSC_VER
assert( operator+(10ul, fd1) + fd2 + fd3 + 10ul == 50ul );
#else
assert( 10ul + fd1 + fd2 + fd3 + 10ul == 50ul );
#endif
}{
const FieldData fd1("0123456789");
const FieldData fd2("0123456789");
Expand All @@ -149,7 +177,11 @@ void testOperators()
const FieldData fd3("0123456789");
const FieldData fd4("0123456789");
const FieldData fd5("0123456789");
#ifdef _MSC_VER
assert( operator+(10ul, fd1) + 20ul + fd2 + fd3 + 10ul + fd4 + 10ul + fd5 == 100ul );
#else
assert( 10ul + fd1 + 20ul + fd2 + fd3 + 10ul + fd4 + 10ul + fd5 == 100ul );
#endif
}
T_PRINT("FieldData::operator +");
}
Expand Down

0 comments on commit bd22bbb

Please sign in to comment.