@@ -17,6 +17,8 @@ AMREX_ENUM(MyColor2,
1717 blue, // 2
1818 Default = green); // 1
1919
20+ AMREX_ENUM (Location, entry = 1 , exit = -1 , after_exit);
21+
2022int main (int argc, char * argv[])
2123{
2224 amrex::Initialize (argc, argv);
@@ -140,5 +142,27 @@ int main (int argc, char* argv[])
140142 AMREX_ALWAYS_ASSERT (my_green == MyColor2::green);
141143 }
142144
145+
146+ {
147+ auto const & kv = amrex::getEnumNameValuePairs<Location>();
148+ amrex::Print () << " Name : Value\n " ;
149+ for (auto const & item : kv) {
150+ amrex::Print () << " " << item.first << " : "
151+ << static_cast <int >(item.second ) << " \n " ;
152+ }
153+ AMREX_ALWAYS_ASSERT (static_cast <int >(Location::entry) == 1 );
154+ AMREX_ALWAYS_ASSERT (static_cast <int >(Location::exit) == -1 );
155+ AMREX_ALWAYS_ASSERT (static_cast <int >(Location::after_exit) == 0 );
156+ AMREX_ALWAYS_ASSERT (amrex::toUnderlying (Location::entry) == 1 );
157+ AMREX_ALWAYS_ASSERT (amrex::toUnderlying (Location::exit) == -1 );
158+ AMREX_ALWAYS_ASSERT (amrex::toUnderlying (Location::after_exit) == 0 );
159+ AMREX_ALWAYS_ASSERT (amrex::getEnum<Location>(" entry" ) == Location::entry);
160+ AMREX_ALWAYS_ASSERT (amrex::getEnum<Location>(" exit" ) == Location::exit);
161+ AMREX_ALWAYS_ASSERT (amrex::getEnum<Location>(" after_exit" ) == Location::after_exit);
162+ AMREX_ALWAYS_ASSERT (amrex::getEnumNameString (Location::entry) == " entry" );
163+ AMREX_ALWAYS_ASSERT (amrex::getEnumNameString (Location::exit) == " exit" );
164+ AMREX_ALWAYS_ASSERT (amrex::getEnumNameString (Location::after_exit) == " after_exit" );
165+ }
166+
143167 amrex::Finalize ();
144168}
0 commit comments