1// (C) Copyright Gennadiy Rozental 2001.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6// See http://www.boost.org/libs/test for the library home page.
7//
8//! @file
9//! Per element comparison manipulator implementation
10// ***************************************************************************
11
12#ifndef BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER
13#define BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER
14
15// Boost Test
16#include <boost/test/tools/detail/fwd.hpp>
17#include <boost/test/tools/detail/indirections.hpp>
18
19#include <boost/test/tools/assertion.hpp>
20#include <boost/test/tools/collection_comparison_op.hpp>
21
22#include <boost/test/detail/suppress_warnings.hpp>
23
24//____________________________________________________________________________//
25
26namespace boost {
27namespace test_tools {
28
29// ************************************************************************** //
30// ************** per element comparison manipulator ************** //
31// ************************************************************************** //
32
33//! Per element comparison manipulator, for containers
34struct per_element {};
35
36//____________________________________________________________________________//
37
38inline int
39operator<<( unit_test::lazy_ostream const&, per_element ) { return 0; }
40
41//____________________________________________________________________________//
42
43namespace tt_detail {
44
45template<typename T1, typename T2, typename OP>
46inline assertion_result
47operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,OP> > const& ae, per_element )
48{
49 typedef typename OP::elem_op elem_op;
50 return assertion::op::element_compare<elem_op>( ae.m_e.lhs().value(), ae.m_e.rhs() );
51}
52
53//____________________________________________________________________________//
54
55inline check_type
56operator<<( assertion_type const&, per_element )
57{
58 return CHECK_BUILT_ASSERTION;
59}
60
61//____________________________________________________________________________//
62
63} // namespace tt_detail
64} // namespace test_tools
65} // namespace boost
66
67#include <boost/test/detail/enable_warnings.hpp>
68
69#endif // BOOST_TEST_TOOLS_DETAIL_PER_ELEMENT_MANIP_HPP_050815GER
70