]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/numeric/odeint/test/is_resizeable.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / numeric / odeint / test / is_resizeable.cpp
1 /*
2 [auto_generated]
3 libs/numeric/odeint/test/is_resizeable.cpp
4
5 [begin_description]
6 This file tests is_resizeable meta-function of odeint.
7 [end_description]
8
9 Copyright 2012 Karsten Ahnert
10 Copyright 2012 Mario Mulansky
11
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
15 */
16
17 // disable checked iterator warning for msvc
18 #include <boost/config.hpp>
19 #ifdef BOOST_MSVC
20 #pragma warning(disable:4996)
21 #endif
22
23 #define BOOST_TEST_MODULE odeint_is_resizeable
24
25 #include <vector>
26 #include <cmath>
27
28 #include <boost/test/unit_test.hpp>
29
30 #include <boost/numeric/odeint/util/is_resizeable.hpp>
31 #include <boost/fusion/include/vector.hpp>
32 #include <boost/units/systems/si/length.hpp>
33 #include <boost/units/systems/si/time.hpp>
34 #include <boost/units/systems/si/velocity.hpp>
35 #include <boost/units/systems/si/acceleration.hpp>
36 #include <boost/units/systems/si/io.hpp>
37
38
39 using namespace boost::unit_test;
40 using namespace boost::numeric::odeint;
41
42 template< typename T > struct my_seq1 {};
43 template< typename T > struct my_seq2 {};
44
45 namespace boost { namespace fusion { namespace traits {
46
47 template< typename T > struct is_sequence< my_seq1< T > > : boost::true_type {};
48 template< typename T > struct is_sequence< my_seq2< T > > : boost::true_type {};
49 } } } // boost::fusion::traits
50
51 namespace boost { namespace numeric { namespace odeint {
52
53 template< typename T >
54 struct is_resizeable< my_seq2< T > > : boost::true_type {};
55
56 } } } // boost::numeric::odeint
57
58
59
60 BOOST_AUTO_TEST_CASE( test_vector )
61 {
62 BOOST_CHECK( is_resizeable< std::vector< int > >::value );
63 }
64
65 BOOST_AUTO_TEST_CASE( test_double )
66 {
67 BOOST_CHECK( !( is_resizeable< double >::value ) );
68 }
69
70 BOOST_AUTO_TEST_CASE( test_fusion_vector_of_vector )
71 {
72 typedef boost::fusion::vector< std::vector< double > , std::vector< double > > state_type;
73 BOOST_CHECK( is_resizeable< state_type >::value );
74 }
75
76 BOOST_AUTO_TEST_CASE( test_fusion_vector_of_double )
77 {
78 typedef boost::fusion::vector< double , double > state_type;
79 BOOST_CHECK( !( is_resizeable< state_type >::value ) );
80 }
81
82 BOOST_AUTO_TEST_CASE( test_fusion_vector_mixed1 )
83 {
84 typedef boost::fusion::vector< double , std::vector< double > > state_type;
85 BOOST_CHECK( is_resizeable< state_type >::value);
86 }
87
88 BOOST_AUTO_TEST_CASE( test_fusion_vector_mixed2 )
89 {
90 typedef boost::fusion::vector< std::vector< double > , double > state_type;
91 BOOST_CHECK( is_resizeable< state_type >::value );
92 }
93
94 BOOST_AUTO_TEST_CASE( test_fusion_quantity_sequence )
95 {
96 namespace units = boost::units;
97 namespace si = boost::units::si;
98
99 typedef double value_type;
100 typedef units::quantity< si::time , value_type > time_type;
101 typedef units::quantity< si::length , value_type > length_type;
102 typedef units::quantity< si::velocity , value_type > velocity_type;
103 typedef boost::fusion::vector< length_type , velocity_type > state_type;
104
105 BOOST_CHECK( !( is_resizeable< state_type >::value ) );
106 }
107
108 BOOST_AUTO_TEST_CASE( test_my_seq1 )
109 {
110 BOOST_CHECK( !is_resizeable< my_seq1< double > >::value );
111 }
112
113 BOOST_AUTO_TEST_CASE( test_my_seq2 )
114 {
115 BOOST_CHECK( is_resizeable< my_seq2< double > >::value );
116 }