mirror of
https://github.com/BlackMATov/enum.hpp.git
synced 2025-12-13 06:59:45 +07:00
readme api
This commit is contained in:
@@ -21,6 +21,8 @@ namespace
|
||||
(white = red | green | blue))
|
||||
}
|
||||
|
||||
ENUM_HPP_REGISTER_TRAITS(color)
|
||||
|
||||
TEST_CASE("examples") {
|
||||
SECTION("traits_using") {
|
||||
// size
|
||||
@@ -50,4 +52,12 @@ TEST_CASE("examples") {
|
||||
std::cout << n << ",";
|
||||
} // stdout: red,green,blue,
|
||||
}
|
||||
|
||||
SECTION("generic_context") {
|
||||
// to string
|
||||
static_assert(enum_hpp::to_string(color::red) == "red");
|
||||
|
||||
// from string
|
||||
static_assert(enum_hpp::from_string<color>("red") == color::red);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user