mirror of
https://github.com/aantron/better-enums.git
synced 2025-12-06 08:46:42 +08:00
Add test for ostream operator
This commit is contained in:
parent
d94b21a7e0
commit
c71b891c87
@ -1,3 +1,4 @@
|
||||
#include <iosfwd>
|
||||
#include <stdexcept>
|
||||
#include <cxxtest/TestSuite.h>
|
||||
#include <enum.h>
|
||||
@ -125,6 +126,17 @@ static_assert_1(*Channel::_values().begin() == +Channel::Red);
|
||||
static_assert_1(*(Channel::_values().end() - 1) == +Channel::Blue);
|
||||
static_assert_1(Channel::_values()[1] == +Channel::Green);
|
||||
|
||||
namespace name_clash_test {
|
||||
|
||||
struct Foo {};
|
||||
std::ostream& operator<<(std::ostream&, Foo);
|
||||
|
||||
BETTER_ENUM(Enum, int, ONE, TWO, THREE)
|
||||
|
||||
static_assert_1((std::is_same<decltype(std::declval<std::ostream&>() << +Enum::ONE), std::ostream&>()));
|
||||
|
||||
}
|
||||
|
||||
#ifdef BETTER_ENUMS_CONSTEXPR_TO_STRING
|
||||
|
||||
constexpr bool same_string(const char *r, const char *s, size_t index = 0)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user