diff --git a/test/compile_time/Makefile b/test/compile_time/Makefile new file mode 100644 index 00000000..fdbd1bb4 --- /dev/null +++ b/test/compile_time/Makefile @@ -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 diff --git a/test/compile_time/driver.hpp b/test/compile_time/driver.hpp new file mode 100644 index 00000000..8d06e6de --- /dev/null +++ b/test/compile_time/driver.hpp @@ -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 diff --git a/test/compile_time/vector_construction.cpp b/test/compile_time/vector_construction.cpp new file mode 100644 index 00000000..18f9f16b --- /dev/null +++ b/test/compile_time/vector_construction.cpp @@ -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 + +namespace fusion = boost::fusion; + +namespace +{ + template + struct distinct + {}; + + template + 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" diff --git a/test/compile_time/vector_intrinsic.cpp b/test/compile_time/vector_intrinsic.cpp new file mode 100644 index 00000000..3fa3a77e --- /dev/null +++ b/test/compile_time/vector_intrinsic.cpp @@ -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 +#include + +namespace fusion = boost::fusion; + +namespace +{ + template + struct distinct + {}; + + template + 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::type va0; + typedef typename fusion::result_of::value_at_c::type va1; + typedef typename fusion::result_of::value_at_c::type va2; + typedef typename fusion::result_of::value_at_c::type va3; + typedef typename fusion::result_of::value_at_c::type va4; + + typedef typename fusion::result_of::value_at_c::type va5; + typedef typename fusion::result_of::value_at_c::type va6; + typedef typename fusion::result_of::value_at_c::type va7; + typedef typename fusion::result_of::value_at_c::type va8; + typedef typename fusion::result_of::value_at_c::type va9; + + fusion::begin(v); + fusion::end(v); + fusion::size(v); + } +} + +#include "./driver.hpp" diff --git a/test/compile_time/vector_iteration.cpp b/test/compile_time/vector_iteration.cpp new file mode 100644 index 00000000..ee63bee5 --- /dev/null +++ b/test/compile_time/vector_iteration.cpp @@ -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 +#include + +namespace fusion = boost::fusion; + +namespace +{ + template + struct distinct + {}; + + struct null_op + { + template + void operator()(T const& t) const + {} + }; + + template + 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"