From 96054b0b48a2ad8f5eb27a402b7566032213713e Mon Sep 17 00:00:00 2001 From: Neil Groves Date: Fri, 21 Feb 2014 17:50:28 +0000 Subject: [PATCH] unit test type_erased.cpp corrected mix of value types under test. --- test/adaptor_test/type_erased.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/test/adaptor_test/type_erased.cpp b/test/adaptor_test/type_erased.cpp index fd3ee5f..60e6e39 100644 --- a/test/adaptor_test/type_erased.cpp +++ b/test/adaptor_test/type_erased.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -30,12 +31,12 @@ namespace boost_range_adaptor_type_erased_test { } - MockType(int x) + MockType(boost::int32_t x) : m_x(x) { } - int get() const { return m_x; } + boost::int32_t get() const { return m_x; } inline bool operator==(const MockType& other) const { @@ -48,7 +49,15 @@ namespace boost_range_adaptor_type_erased_test } private: - int m_x; + boost::int32_t m_x; + }; + + class MockType2 : public MockType + { + public: + MockType2() {} + MockType2(boost::int32_t x) : MockType(x) { } + MockType2(const MockType& other) : MockType(other) { } }; inline std::ostream& operator<<(std::ostream& out, const MockType& obj) @@ -418,15 +427,12 @@ namespace boost_range_adaptor_type_erased_test template void test_type_erased_mix_values_driver() { - test_type_erased_mix_values_impl< Traversal, int, char, const int&, short, const int& >(); - test_type_erased_mix_values_impl< Traversal, int, int*, const int&, char, const int& >(); - test_type_erased_mix_values_impl< Traversal, MockType, char, const MockType&, short, const MockType& >(); - - // In fact value type should have no effect in the eligibility - // for conversion, hence we should be able to convert it - // completely backwards! - test_type_erased_mix_values_impl< Traversal, int, short, const int&, char, const int& >(); - test_type_erased_mix_values_impl< Traversal, int, char, const int&, int*, const int& >(); + test_type_erased_mix_values_impl< + Traversal, + MockType, + MockType2, const MockType&, + MockType, const MockType& + >(); } void test_type_erased_mix_values()