• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Range library
2 //
3 // Copyright Neil Groves 2014. Use, modification and distribution is subject
4 // to the Boost Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // For more information, see http://www.boost.org/libs/range
9 //
10 #ifndef BOOST_RANGE_UNIT_TEST_ADAPTOR_MOCK_RANGE_HPP_INCLUDED
11 #define BOOST_RANGE_UNIT_TEST_ADAPTOR_MOCK_RANGE_HPP_INCLUDED
12 
13 #include "mock_iterator.hpp"
14 #include <boost/range/iterator_range_core.hpp>
15 
16 namespace boost
17 {
18     namespace range
19     {
20         namespace unit_test
21         {
22 
23 // Make a non-empty range that models the corresponding range concept.
24 // This is only useful in unit tests. It is main use is to help test concepts
25 // assertions are present.
26 template<typename TraversalTag>
27 iterator_range<mock_iterator<TraversalTag> >&
mock_range()28     mock_range()
29 {
30     static iterator_range<mock_iterator<TraversalTag> > instance(
31                 mock_iterator<TraversalTag>(0),
32                 mock_iterator<TraversalTag>(1));
33     return instance;
34 }
35 
36 template<typename TraversalTag>
37 const iterator_range<mock_iterator<TraversalTag> >&
mock_const_range()38     mock_const_range()
39 {
40     static iterator_range<mock_iterator<TraversalTag> > instance(
41                 mock_iterator<TraversalTag>(0),
42                 mock_iterator<TraversalTag>(1));
43     return instance;
44 }
45 
46         } // namespace unit_test
47     } // namespace range
48 } // namespace boost
49 
50 #endif // include guard
51