diff --git a/test/sequence/adapt_adt.cpp b/test/sequence/adapt_adt.cpp index 73868367..d4f4a8c2 100644 --- a/test/sequence/adapt_adt.cpp +++ b/test/sequence/adapt_adt.cpp @@ -71,6 +71,24 @@ namespace ns int y; }; #endif + + // A sequence that has data members defined in an unrelated namespace + // (std, in this case). This allows testing ADL issues. + class name + { + public: + name() {} + name(const std::string& last, const std::string& first) + : last(last), first(first) {} + + const std::string& get_last() const { return last; } + const std::string& get_first() const { return first; } + void set_last(const std::string& last_) { last = last_; } + void set_first(const std::string& first_) { first = first_; } + private: + std::string last; + std::string first; + }; } BOOST_FUSION_ADAPT_ADT( @@ -87,6 +105,12 @@ BOOST_FUSION_ADAPT_ADT( ) #endif +BOOST_FUSION_ADAPT_ADT( + ns::name, + (const std::string&, const std::string&, obj.get_last(), obj.set_last(val)) + (const std::string&, const std::string&, obj.get_first(), obj.set_first(val)) +) + int main() { @@ -130,6 +154,20 @@ main() BOOST_TEST(v3 > v2); BOOST_TEST(v3 >= v2); } + + { + fusion::vector v1("Lincoln", "Abraham"); + ns::name v2("Roosevelt", "Franklin"); + ns::name v3("Roosevelt", "Theodore"); + BOOST_TEST(v1 < v2); + BOOST_TEST(v1 <= v2); + BOOST_TEST(v2 > v1); + BOOST_TEST(v2 >= v1); + BOOST_TEST(v2 < v3); + BOOST_TEST(v2 <= v3); + BOOST_TEST(v3 > v2); + BOOST_TEST(v3 >= v2); + } { // conversion from ns::point to vector diff --git a/test/sequence/adapt_tpl_adt.cpp b/test/sequence/adapt_tpl_adt.cpp index 2f0d4c6b..aeb0f721 100644 --- a/test/sequence/adapt_tpl_adt.cpp +++ b/test/sequence/adapt_tpl_adt.cpp @@ -67,6 +67,7 @@ main() using namespace boost::fusion; typedef ns::point point; + typedef ns::point name; std::cout << tuple_open('['); std::cout << tuple_close(']'); @@ -106,6 +107,20 @@ main() BOOST_TEST(v3 >= v2); } + { + boost::fusion::vector v1("Lincoln", "Abraham"); + name v2("Roosevelt", "Franklin"); + name v3("Roosevelt", "Theodore"); + BOOST_TEST(v1 < v2); + BOOST_TEST(v1 <= v2); + BOOST_TEST(v2 > v1); + BOOST_TEST(v2 >= v1); + BOOST_TEST(v2 < v3); + BOOST_TEST(v2 <= v3); + BOOST_TEST(v3 > v2); + BOOST_TEST(v3 >= v2); + } + { // conversion from point to vector point p(5, 3); diff --git a/test/sequence/define_struct_inline.cpp b/test/sequence/define_struct_inline.cpp index 8885275d..9e3f6277 100644 --- a/test/sequence/define_struct_inline.cpp +++ b/test/sequence/define_struct_inline.cpp @@ -29,6 +29,8 @@ struct cls namespace ns { BOOST_FUSION_DEFINE_STRUCT_INLINE(s, (int, m)) + + BOOST_FUSION_DEFINE_STRUCT_INLINE(empty_struct, ) } int @@ -40,6 +42,11 @@ main() std::cout << tuple_close(']'); std::cout << tuple_delimiter(", "); + { + BOOST_STATIC_ASSERT(boost::fusion::result_of::size::value == 0); + BOOST_STATIC_ASSERT(boost::fusion::result_of::empty::value); + } + { BOOST_MPL_ASSERT_NOT((traits::is_view)); cls::point p(123, 456); diff --git a/test/sequence/define_tpl_struct_inline.cpp b/test/sequence/define_tpl_struct_inline.cpp index 9aa574a0..1052f5db 100644 --- a/test/sequence/define_tpl_struct_inline.cpp +++ b/test/sequence/define_tpl_struct_inline.cpp @@ -30,6 +30,8 @@ struct cls namespace ns { BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), s, (M, m)) + + BOOST_FUSION_DEFINE_TPL_STRUCT_INLINE((M), empty_struct, ) } int @@ -43,6 +45,11 @@ main() std::cout << tuple_close(']'); std::cout << tuple_delimiter(", "); + { + BOOST_STATIC_ASSERT(boost::fusion::result_of::size >::value == 0); + BOOST_STATIC_ASSERT(boost::fusion::result_of::empty >::value); + } + { BOOST_MPL_ASSERT_NOT((traits::is_view)); point p(123, 456);