readme api

This commit is contained in:
2019-11-22 10:22:40 +07:00
parent 106dac17d7
commit c3e3b8bda2
4 changed files with 163 additions and 68 deletions

View File

@@ -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);
}
}