Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r69952 - in sandbox/enums/libs/enums/test: . enum_range
From: vicente.botet_at_[hidden]
Date: 2011-03-13 11:37:01


Author: viboes
Date: 2011-03-13 11:36:58 EDT (Sun, 13 Mar 2011)
New Revision: 69952
URL: http://svn.boost.org/trac/boost/changeset/69952

Log:
Enums: added foreach test
Added:
   sandbox/enums/libs/enums/test/enum_range/foreach.pass.cpp (contents, props changed)
Text files modified:
   sandbox/enums/libs/enums/test/Jamfile.v2 | 1 +
   1 files changed, 1 insertions(+), 0 deletions(-)

Modified: sandbox/enums/libs/enums/test/Jamfile.v2
==============================================================================
--- sandbox/enums/libs/enums/test/Jamfile.v2 (original)
+++ sandbox/enums/libs/enums/test/Jamfile.v2 2011-03-13 11:36:58 EDT (Sun, 13 Mar 2011)
@@ -101,6 +101,7 @@
   test-suite "enum_range"
         :
         [ run enum_range/for_each.pass.cpp : : : : enum_range__for_each__pass ]
+ [ run enum_range/foreach.pass.cpp : : : : enum_range__foreach__pass ]
         [ run enum_range/begin.pass.cpp : : : : enum_range__begin__pass ]
         [ run enum_range/random_access_range_concept.pass.cpp : : : : enum_range__random_access_range_concept__pass ]
   ;

Added: sandbox/enums/libs/enums/test/enum_range/foreach.pass.cpp
==============================================================================
--- (empty file)
+++ sandbox/enums/libs/enums/test/enum_range/foreach.pass.cpp 2011-03-13 11:36:58 EDT (Sun, 13 Mar 2011)
@@ -0,0 +1,42 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2011.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/enums for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include "./EnumClass.hpp"
+#include <boost/detail/lightweight_test.hpp>
+#include <boost/enums/enum_range.hpp>
+#include <boost/foreach.hpp>
+#include <cstddef>
+
+static std::size_t cnt=0;
+void p(EnumClass )
+{
+ cnt++;
+}
+
+#define BOOST_ENUMS_FOREACH(EC, V) BOOST_FOREACH(EC V, boost::enums::enum_range<EC>())
+
+int main() {
+
+ using namespace boost;
+ using namespace boost::enums;
+
+
+ {
+ //BOOST_FOREACH(EnumClass e, enum_range<EnumClass>())
+ BOOST_ENUMS_FOREACH(EnumClass, e)
+ {
+ cnt++;
+ }
+ BOOST_TEST(cnt==enums::meta::size<EnumClass>::value);
+ }
+ return boost::report_errors();
+}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk