Ticket #7569: define-struct-inline-msvc-wknd-tests.patch
File define-struct-inline-msvc-wknd-tests.patch, 5.3 KB (added by , 10 years ago) |
---|
-
libs/fusion/test/sequence/define_struct_inline.cpp
26 26 ) 27 27 }; 28 28 29 template <typename = int> 30 struct tpl_cls 31 { 32 BOOST_FUSION_DEFINE_STRUCT_INLINE( 33 point, 34 (int, x) 35 (int, y) 36 ) 37 }; 38 29 39 namespace ns 30 40 { 31 41 BOOST_FUSION_DEFINE_STRUCT_INLINE(s, (int, m)) … … 33 43 BOOST_FUSION_DEFINE_STRUCT_INLINE(empty_struct, ) 34 44 } 35 45 36 int 37 main()46 template <typename Point> 47 void run_test() 38 48 { 39 49 using namespace boost::fusion; 40 50 … … 48 58 } 49 59 50 60 { 51 BOOST_MPL_ASSERT_NOT((traits::is_view< cls::point>));52 cls::point p(123, 456);61 BOOST_MPL_ASSERT_NOT((traits::is_view<Point>)); 62 Point p(123, 456); 53 63 54 64 std::cout << at_c<0>(p) << std::endl; 55 65 std::cout << at_c<1>(p) << std::endl; … … 60 70 at_c<1>(p) = 9; 61 71 BOOST_TEST(p == make_vector(6, 9)); 62 72 63 BOOST_STATIC_ASSERT(boost::fusion::result_of::size< cls::point>::value == 2);64 BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty< cls::point>::value);73 BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Point>::value == 2); 74 BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<Point>::value); 65 75 66 76 BOOST_TEST(front(p) == 6); 67 77 BOOST_TEST(back(p) == 9); … … 69 79 70 80 { 71 81 vector<int, float> v1(4, 2); 72 cls::point v2(5, 3);82 Point v2(5, 3); 73 83 vector<long, double> v3(5, 4); 74 84 BOOST_TEST(v1 < v2); 75 85 BOOST_TEST(v1 <= v2); … … 82 92 } 83 93 84 94 { 85 // conversion from cls::point to vector86 cls::point p(5, 3);95 // conversion from Point to vector 96 Point p(5, 3); 87 97 vector<int, long> v(p); 88 98 v = p; 89 99 } 90 100 91 101 { 92 // conversion from cls::point to list93 cls::point p(5, 3);102 // conversion from Point to list 103 Point p(5, 3); 94 104 list<int, long> l(p); 95 105 l = p; 96 106 } … … 105 115 } 106 116 107 117 { 108 cls::point p = make_list(5,3);118 Point p = make_list(5,3); 109 119 BOOST_TEST(p == make_vector(5,3)); 110 120 111 121 p = make_list(3,5); 112 122 BOOST_TEST(p == make_vector(3,5)); 113 123 } 124 } 114 125 126 int 127 main() 128 { 129 run_test<cls::point>(); // test with non-template enclosing class 130 run_test<tpl_cls<>::point>(); // test with template enclosing class 115 131 return boost::report_errors(); 132 116 133 } 117 134 -
libs/fusion/test/sequence/define_tpl_struct_inline.cpp
27 27 ) 28 28 }; 29 29 30 template <typename = int> 31 struct tpl_cls 32 { 33 BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE( 34 (X)(Y), 35 point, 36 (X, x) 37 (Y, y) 38 ) 39 }; 40 30 41 namespace ns 31 42 { 32 43 BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), s, (M, m)) … … 34 45 BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), empty_struct, ) 35 46 } 36 47 37 int 38 main()48 template <typename Point> 49 void run_test() 39 50 { 40 51 using namespace boost::fusion; 41 52 42 typedef cls::point<int, int> point;43 44 53 std::cout << tuple_open('['); 45 54 std::cout << tuple_close(']'); 46 55 std::cout << tuple_delimiter(", "); … … 51 60 } 52 61 53 62 { 54 BOOST_MPL_ASSERT_NOT((traits::is_view< point>));55 point p(123, 456);63 BOOST_MPL_ASSERT_NOT((traits::is_view<Point>)); 64 Point p(123, 456); 56 65 57 66 std::cout << at_c<0>(p) << std::endl; 58 67 std::cout << at_c<1>(p) << std::endl; … … 63 72 at_c<1>(p) = 9; 64 73 BOOST_TEST(p == make_vector(6, 9)); 65 74 66 BOOST_STATIC_ASSERT(boost::fusion::result_of::size< point>::value == 2);67 BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty< point>::value);75 BOOST_STATIC_ASSERT(boost::fusion::result_of::size<Point>::value == 2); 76 BOOST_STATIC_ASSERT(!boost::fusion::result_of::empty<Point>::value); 68 77 69 78 BOOST_TEST(front(p) == 6); 70 79 BOOST_TEST(back(p) == 9); … … 72 81 73 82 { 74 83 vector<int, float> v1(4, 2); 75 point v2(5, 3);84 Point v2(5, 3); 76 85 vector<long, double> v3(5, 4); 77 86 BOOST_TEST(v1 < v2); 78 87 BOOST_TEST(v1 <= v2); … … 85 94 } 86 95 87 96 { 88 // conversion from point to vector89 point p(5, 3);97 // conversion from Point to vector 98 Point p(5, 3); 90 99 vector<int, long> v(p); 91 100 v = p; 92 101 } 93 102 94 103 { 95 // conversion from point to list96 point p(5, 3);104 // conversion from Point to list 105 Point p(5, 3); 97 106 list<int, long> l(p); 98 107 l = p; 99 108 } … … 109 118 110 119 111 120 { 112 point p = make_list(5,3);121 Point p = make_list(5,3); 113 122 BOOST_TEST(p == make_vector(5,3)); 114 123 115 124 p = make_list(3,5); 116 125 BOOST_TEST(p == make_vector(3,5)); 117 126 } 127 } 118 128 129 int 130 main() 131 { 132 run_test<cls::point<int, int> >(); // test non-template enclosing class 133 run_test<tpl_cls<>::point<int, int> >(); // test template enclosing class 134 119 135 return boost::report_errors(); 120 136 } 121 137