Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65045 - sandbox/SOC/2009/fusion/libs/fusion/test/compile_time
From: mr.chr.schmidt_at_[hidden]
Date: 2010-08-26 18:26:11


Author: cschmidt
Date: 2010-08-26 18:26:07 EDT (Thu, 26 Aug 2010)
New Revision: 65045
URL: http://svn.boost.org/trac/boost/changeset/65045

Log:
cltime jamfile test
Added:
   sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/
   sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/Jamfile (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/driver.hpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/fold.cpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/transform.cpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_construction.cpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_intrinsic.cpp (contents, props changed)
   sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_iteration.cpp (contents, props changed)

Added: sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/Jamfile 2010-08-26 18:26:07 EDT (Thu, 26 Aug 2010)
@@ -0,0 +1,46 @@
+#==============================================================================
+# Copyright (c) 2003-2006 Joel de Guzman
+# Copyright (c) 2006 Dan Marsden
+# Copyright (c) 2010 Christopher Schmidt
+#
+# Use, modification and distribution is 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)
+#==============================================================================
+
+import notfile ;
+
+project
+ : requirements
+ <define>BOOST_FUSION_ENABLE_STATIC_ASSERTS
+ <warnings>all
+ <toolset>gcc:<cxxflags>-Wno-long-long
+ ;
+
+module timing-module
+{
+ rule timing-callback ( target-id * : target : start end user system )
+ {
+ echo $(target-id) ":" $(start) $(end) ;
+ }
+}
+IMPORT timing-module : timing-callback : : timing-callback ;
+
+rule report-time ( target * : source * : properties * )
+{
+ ALWAYS $(source) ;
+ __TIMING_RULE__ on $(source) = timing-callback $(target:G=) ;
+ JAM_SEMAPHORE on $(source) = fusion-compile-time-test ;
+}
+
+obj fold : fold.cpp ;
+notfile fold.dummy : <action>blub @report-time test : fold ;
+
+#for local test-file in [ glob-tree *.cpp ]
+#{
+# obj $(test-file:B) : $(test-file) ;
+# notfile $(test-file).dummy : <action>blub @report-time test : $(test-file:B) ;
+
+# run $(test-file) : : : : ;
+#}
+

Added: sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/driver.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/driver.hpp 2010-08-26 18:26:07 EDT (Thu, 26 Aug 2010)
@@ -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: sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/fold.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/fold.cpp 2010-08-26 18:26:07 EDT (Thu, 26 Aug 2010)
@@ -0,0 +1,42 @@
+/*==============================================================================
+ 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/fold.hpp>
+#include <boost/fusion/include/vector.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+ template<int n, int batch>
+ struct distinct
+ {};
+
+ struct f
+ {
+ typedef int result_type;
+
+ template<int n, int batch>
+ int operator()(int state, distinct<n, batch> const& d) const
+ {
+ return state + n;
+ }
+ };
+
+ 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::fold(v, 0, f());
+ }
+}
+
+#include "driver.hpp"

Added: sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/transform.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/transform.cpp 2010-08-26 18:26:07 EDT (Thu, 26 Aug 2010)
@@ -0,0 +1,55 @@
+/*==============================================================================
+ 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/transform.hpp>
+#include <boost/fusion/include/for_each.hpp>
+#include <boost/fusion/include/vector.hpp>
+
+namespace fusion = boost::fusion;
+
+namespace
+{
+ template<int n, int batch>
+ struct distinct
+ {
+ static const int value = n;
+ };
+
+ struct f
+ {
+ typedef int result_type;
+
+ template<typename T>
+ result_type operator()(T const& t) const
+ {
+ return T::value;
+ }
+ };
+
+ struct touch
+ {
+ template<typename T>
+ void operator()(T const&) 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;
+
+ // We're testing transform really
+ // for_each call is to force iteration through the lazy
+ // transform, otherwise very little will happen.
+ fusion::for_each(fusion::transform(v, f()), touch());
+ }
+}
+
+#include "driver.hpp"

Added: sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_construction.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_construction.cpp 2010-08-26 18:26:07 EDT (Thu, 26 Aug 2010)
@@ -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: sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_intrinsic.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_intrinsic.cpp 2010-08-26 18:26:07 EDT (Thu, 26 Aug 2010)
@@ -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: sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_iteration.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2009/fusion/libs/fusion/test/compile_time/vector_iteration.cpp 2010-08-26 18:26:07 EDT (Thu, 26 Aug 2010)
@@ -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"


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