$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r49409 - trunk/libs/fusion/test/compile_time
From: danmarsden_at_[hidden]
Date: 2008-10-20 17:36:04
Author: danmarsden
Date: 2008-10-20 17:36:04 EDT (Mon, 20 Oct 2008)
New Revision: 49409
URL: http://svn.boost.org/trac/boost/changeset/49409
Log:
Adding simple compile time tests
Added:
   trunk/libs/fusion/test/compile_time/   (props changed)
   trunk/libs/fusion/test/compile_time/Makefile   (contents, props changed)
   trunk/libs/fusion/test/compile_time/driver.hpp   (contents, props changed)
   trunk/libs/fusion/test/compile_time/vector_construction.cpp   (contents, props changed)
   trunk/libs/fusion/test/compile_time/vector_intrinsic.cpp   (contents, props changed)
   trunk/libs/fusion/test/compile_time/vector_iteration.cpp   (contents, props changed)
Added: trunk/libs/fusion/test/compile_time/Makefile
==============================================================================
--- (empty file)
+++ trunk/libs/fusion/test/compile_time/Makefile	2008-10-20 17:36:04 EDT (Mon, 20 Oct 2008)
@@ -0,0 +1,24 @@
+#=============================================================================
+#    Copyright (c) 2008 Dan Marsden
+#  
+#    Use modification and distribution are subject to 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).
+#==============================================================================
+
+CXX=g++
+CXXFLAGS=-I$(BOOST_ROOT)
+
+all: vector_construction vector_iteration vector_intrinsic
+
+vector_construction: vector_construction.cpp
+	time $(CXX) $(CXXFLAGS) vector_construction.cpp -o vector_construction
+
+vector_iteration: vector_iteration.cpp
+	time $(CXX) $(CXXFLAGS) vector_iteration.cpp -o vector_iteration
+
+vector_intrinsic: vector_intrinsic.cpp
+	time $(CXX) $(CXXFLAGS) vector_intrinsic.cpp -o vector_intrinsic
+
+clean:
+	rm -f vector_construction vector_construction.o vector_iteration vector_iteration.o vector_intrinsic vector_intrinsic.o
Added: trunk/libs/fusion/test/compile_time/driver.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/fusion/test/compile_time/driver.hpp	2008-10-20 17:36:04 EDT (Mon, 20 Oct 2008)
@@ -0,0 +1,75 @@
+/*=============================================================================
+    Copyright (c) 2008 Dan Marsden
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#if !defined(BOOST_FUSION_COMPILE_TIME_DRIVER)
+#define BOOST_FUSION_COMPILE_TIME_DRIVER
+
+int main()
+{
+  test<0>();
+  test<1>();
+  test<2>();
+  test<3>();
+  test<4>();
+
+  test<5>();
+  test<6>();
+  test<7>();
+  test<8>();
+  test<9>();
+
+  test<10>();
+  test<11>();
+  test<12>();
+  test<13>();
+  test<14>();
+
+  test<15>();
+  test<16>();
+  test<17>();
+  test<18>();
+  test<19>();
+
+  test<20>();
+  test<21>();
+  test<22>();
+  test<23>();
+  test<24>();
+
+  test<25>();
+  test<26>();
+  test<27>();
+  test<28>();
+  test<29>();
+
+  test<30>();
+  test<31>();
+  test<32>();
+  test<33>();
+  test<34>();
+
+  test<35>();
+  test<36>();
+  test<37>();
+  test<38>();
+  test<39>();
+
+  test<40>();
+  test<41>();
+  test<42>();
+  test<43>();
+  test<44>();
+
+  test<45>();
+  test<46>();
+  test<47>();
+  test<48>();
+  test<49>();
+}
+
+#endif
Added: trunk/libs/fusion/test/compile_time/vector_construction.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/fusion/test/compile_time/vector_construction.cpp	2008-10-20 17:36:04 EDT (Mon, 20 Oct 2008)
@@ -0,0 +1,28 @@
+/*=============================================================================
+    Copyright (c) 2008 Dan Marsden
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/fusion/include/vector.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+  template<int n, int batch>
+  struct distinct
+  {};
+
+  template<int batch>
+  void test()
+  {
+    fusion::vector<
+      distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
+      distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
+  }
+}
+
+#include "./driver.hpp"
Added: trunk/libs/fusion/test/compile_time/vector_intrinsic.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/fusion/test/compile_time/vector_intrinsic.cpp	2008-10-20 17:36:04 EDT (Mon, 20 Oct 2008)
@@ -0,0 +1,59 @@
+/*=============================================================================
+    Copyright (c) 2008 Dan Marsden
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/intrinsic.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+  template<int n, int batch>
+  struct distinct
+  {};
+
+  template<int batch>
+  void test()
+  {
+    typedef fusion::vector<
+      distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
+      distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v_type;
+
+    v_type v;
+
+    fusion::at_c<0>(v);
+    fusion::at_c<1>(v);
+    fusion::at_c<2>(v);
+    fusion::at_c<3>(v);
+    fusion::at_c<4>(v);
+
+    fusion::at_c<5>(v);
+    fusion::at_c<6>(v);
+    fusion::at_c<7>(v);
+    fusion::at_c<8>(v);
+    fusion::at_c<9>(v);
+
+    typedef typename fusion::result_of::value_at_c<v_type, 0>::type va0;
+    typedef typename fusion::result_of::value_at_c<v_type, 1>::type va1;
+    typedef typename fusion::result_of::value_at_c<v_type, 2>::type va2;
+    typedef typename fusion::result_of::value_at_c<v_type, 3>::type va3;
+    typedef typename fusion::result_of::value_at_c<v_type, 4>::type va4;
+
+    typedef typename fusion::result_of::value_at_c<v_type, 5>::type va5;
+    typedef typename fusion::result_of::value_at_c<v_type, 6>::type va6;
+    typedef typename fusion::result_of::value_at_c<v_type, 7>::type va7;
+    typedef typename fusion::result_of::value_at_c<v_type, 8>::type va8;
+    typedef typename fusion::result_of::value_at_c<v_type, 9>::type va9;
+
+    fusion::begin(v);
+    fusion::end(v);
+    fusion::size(v);
+  }
+}
+
+#include "./driver.hpp"
Added: trunk/libs/fusion/test/compile_time/vector_iteration.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/fusion/test/compile_time/vector_iteration.cpp	2008-10-20 17:36:04 EDT (Mon, 20 Oct 2008)
@@ -0,0 +1,38 @@
+/*=============================================================================
+    Copyright (c) 2008 Dan Marsden
+  
+    Use modification and distribution are subject to 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).
+==============================================================================*/
+
+#include <boost/fusion/include/vector.hpp>
+#include <boost/fusion/include/for_each.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+  template<int n, int batch>
+  struct distinct
+  {};
+
+  struct null_op
+  {
+    template<typename T>
+    void operator()(T const& t) const
+    {}
+  };
+
+  template<int batch>
+  void test()
+  {
+    fusion::vector<
+      distinct<0, batch>, distinct<1, batch>, distinct<2, batch>, distinct<3, batch>, distinct<4, batch>,
+      distinct<5, batch>, distinct<6, batch>, distinct<7, batch>, distinct<8, batch>, distinct<9, batch> > v;
+
+    fusion::for_each(v, null_op());
+  }
+}
+
+#include "./driver.hpp"