21 lines
624 B
C++
21 lines
624 B
C++
|
#include "parse/enum.hpp"
|
||
|
#include "parse/value.hpp"
|
||
|
#include "std.hpp"
|
||
|
#include "tap.hpp"
|
||
|
|
||
|
enum enumeration_t : u16 { FOO, BAR = 2, QUX = 257 };
|
||
|
|
||
|
int main ()
|
||
|
{
|
||
|
cruft::parse::setup<enumeration_t> ({
|
||
|
{ "FOO", FOO },
|
||
|
{ "BAR", BAR },
|
||
|
{ "QUX", QUX },
|
||
|
});
|
||
|
|
||
|
cruft::TAP::logger tap;
|
||
|
tap.expect_eq (FOO, cruft::parse::from_string<enumeration_t> ("FOO"), "enumeration, FOO");
|
||
|
tap.expect_eq (BAR, cruft::parse::from_string<enumeration_t> ("BAR"), "enumeration, BAR");
|
||
|
tap.expect_eq (QUX, cruft::parse::from_string<enumeration_t> ("QUX"), "enumeration, QUX");
|
||
|
return tap.status ();
|
||
|
}
|