Boost logo

Boost :

Subject: [boost] [test] Using BOOST_CHECK_EQUAL with enum
From: Edward Diener (eldiener_at_[hidden])
Date: 2014-08-23 17:41:00


In code I have the expression:

BOOST_CHECK_EQUAL(cnew,e_test_third);

where 'cnew' is:

test_enum cnew;

and test_enum is:

enum test_enum
   {
   e_test_default,
   e_test_first,
   e_test_second,
   e_test_third
   };

This is giving me the error:

..\..\../boost/test/test_tools.hpp:100:1: error: expected ')' before 'do'
  do { \
  ^
..\..\../boost/test/test_tools.hpp:169:5: note: in expansion of macro
'BOOST_CHECK_WITH_ARGS_IMPL'
      BOOST_CHECK_WITH_ARGS_IMPL(
::boost::test_tools::tt_detail::equal_impl_frwd(), "", CHECK,
CHECK_EQUAL, (L)(R) )
      ^
test_auto_value.cpp:64:4: note: in expansion of macro 'BOOST_CHECK_EQUAL'
     BOOST_CHECK_EQUAL(cnew,e_test_third);
     ^

Is Boost Test incapable of checking that an enumeration object equals an
enumerated value ? Is this a known problem ? How do I work around it ?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk