Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
d-frey committed Jun 12, 2018
1 parent 6089b4d commit 5ca9fa6
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion src/test/operators/operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ struct S
#if !defined( _MSC_VER ) || defined( __clang__ )

struct C
: tao::operators::less_than_comparable< C >
: tao::operators::less_than_comparable< C >,
tao::operators::less_than_comparable< C, int >
{
const int i_;

Expand All @@ -162,6 +163,16 @@ constexpr bool operator<( const C& lhs, const C& rhs ) noexcept
return lhs.i_ < rhs.i_;
}

constexpr bool operator<( const C& lhs, const int rhs ) noexcept
{
return lhs.i_ < rhs;
}

constexpr bool operator>( const C& lhs, const int rhs ) noexcept
{
return lhs.i_ > rhs;
}

#endif

int main()
Expand Down Expand Up @@ -239,18 +250,46 @@ int main()
static_assert( c2 < c3, "oops" );
static_assert( c1 < c3, "oops" );

static_assert( c1 < 2, "oops" );
static_assert( c2 < 3, "oops" );
static_assert( c1 < 3, "oops" );

static_assert( c1 <= c2, "oops" );
static_assert( c2 <= c3, "oops" );
static_assert( c1 <= c3, "oops" );

static_assert( c1 <= 2, "oops" );
static_assert( c2 <= 3, "oops" );
static_assert( c1 <= 3, "oops" );

static_assert( 1 <= c2, "oops" );
static_assert( 2 <= c3, "oops" );
static_assert( 1 <= c3, "oops" );

static_assert( c2 > c1, "oops" );
static_assert( c3 > c2, "oops" );
static_assert( c3 > c1, "oops" );

static_assert( c2 > 1, "oops" );
static_assert( c3 > 2, "oops" );
static_assert( c3 > 1, "oops" );

static_assert( 2 > c1, "oops" );
static_assert( 3 > c2, "oops" );
static_assert( 3 > c1, "oops" );

static_assert( c2 >= c1, "oops" );
static_assert( c3 >= c2, "oops" );
static_assert( c3 >= c1, "oops" );

static_assert( c2 >= 1, "oops" );
static_assert( c3 >= 2, "oops" );
static_assert( c3 >= 1, "oops" );

static_assert( 2 >= c1, "oops" );
static_assert( 3 >= c2, "oops" );
static_assert( 3 >= c1, "oops" );

static_assert( !( c1 < c1 ), "oops" ); // NOLINT
static_assert( !( c1 > c1 ), "oops" ); // NOLINT
static_assert( c1 <= c1, "oops" ); // NOLINT
Expand Down

0 comments on commit 5ca9fa6

Please sign in to comment.