libcruft-util/test/introspection/enum_simple.cpp

21 lines
634 B
C++
Raw Normal View History

#include <cruft/util/introspection/enum_simple.hpp>
#include <cruft/util/tap.hpp>
#include <iostream>
int
main ()
{
cruft::TAP::logger tap;
enum enum_t { value0 = 0, value1 = 1, value3 = 3, };
std::cout << cruft::introspection::detail::enum_pretty_function<enum_t, value0> () << '\n';
tap.expect_eq (cruft::introspection::from_string<enum_t> ("value1"), value1, "from_string, dynamic");
tap.expect_eq (cruft::introspection::to_string<enum_t, value1> (), "value1", "to_string, static");
tap.expect_eq (cruft::introspection::to_string (value1), "value1", "to_string, dynamic");
return tap.status ();
}