Skip to content

Commit

Permalink
Adding a few more static assertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
brevzin committed Mar 27, 2020
1 parent 7617459 commit f77f9c3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/test.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ struct D: B { };

static_assert(equality_comparable_with<std::span<int>, std::vector<int>>);
static_assert(totally_ordered_with<std::span<int>, std::vector<int>>);

// mixed const-ness is fine
static_assert(totally_ordered_with<std::span<int>, std::vector<int> const>);
static_assert(totally_ordered_with<std::span<int const>, std::vector<int>>);
static_assert(totally_ordered_with<std::span<int const>, std::vector<int> const>);

static_assert(not equality_comparable_with<std::span<int>, std::list<int>>);
static_assert(not equality_comparable_with<std::span<int>, std::vector<long>>);

Expand All @@ -57,6 +63,10 @@ T const* end(X<T> const& x) { return x.v.data() + x.v.size(); }
static_assert(equality_comparable_with<std::span<int const>, X<int>>);
static_assert(totally_ordered_with<std::span<int const>, X<int>>);

struct NonComparable { };
static_assert(not equality_comparable_with<std::span<NonComparable>, std::span<NonComparable>>);
static_assert(not totally_ordered_with<std::span<NonComparable>, std::span<NonComparable>>);

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

Expand Down

0 comments on commit f77f9c3

Please sign in to comment.