31#if defined (__IBMCPP__) && !defined (_RWSTD_NO_IMPLICIT_INCLUSION)
34# define _RWSTD_NO_IMPLICIT_INCLUSION
48#ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION
51pair <FwdIter<lt_comp<assign<base<cpy_ctor> > > >,
58pair <FwdIter<lt_comp<assign<base<cpy_ctor> > > >,
79 Y (
char val,
int ): xval_ () {
80 typedef unsigned char UChar;
134template <
class T,
class ForwardIterator>
138 std::size_t result_loff,
139 std::size_t result_uoff,
147 const char*
const tname =
"UserClass";
148 const char*
const itname =
type_name (it, (
T*)0);
149 const char*
const funname =
predicate ?
"LessThan" :
"operator<()";
151 const std::size_t
nsrc = std::strlen (src_str);
152 T*
const xsrc = T::from_char (src_str,
nsrc + 1);
153 T*
const xsrc_end = xsrc +
nsrc;
155 if (
nsrc < result_uoff)
166 const Y value (val_char, 0 );
173 T::n_total_op_lt_ = 0;
186 const std::size_t loff = std::size_t (
result.first.cur_ - xsrc);
187 const std::size_t uoff = std::size_t (
result.second.cur_ - xsrc);
189 rw_assert (loff == result_loff && uoff == result_uoff, 0,
line,
190 "equal_range <%s, const %s&%{?}, %s%{;}> (\"%s\", %#c, ...) "
191 "== first + { %zu, %zu }, got first + { %zu, %zu }",
192 itname, tname,
predicate, funname, src_str, val_char,
193 loff, uoff, result_loff, result_uoff);
200 "equal_range <%s, const %s&%{?}, %s%{;}> (\"%s\", %#c, ...) "
201 "complexity: invoked %4$s at most %zu times, got %zu",
202 itname, tname,
predicate, funname, src_str, val_char,
210template <
class T,
class ForwardIterator>
215 const char*
const itname =
type_name (it, (
T*)0);
216 const char*
const funname =
predicate ?
"LessThan" :
"operator<()";
219 "std::equal_range (%s, %1$s, const UserClass&%{?}, %s%{;})",
222#define TEST(str, val, loff, uoff, comp) \
223 test_equal_range (__LINE__, str, val, std::size_t (loff), \
224 std::size_t (uoff), std::size_t (comp), \
225 it, (T*)0, predicate)
235 TEST (
"",
'a', 0, 0, 0);
236 TEST (
"a",
'a', 0, 1, 2);
237 TEST (
"a",
'b', 1, 1, 1);
238 TEST (
"b",
'a', 0, 0, 2);
240 TEST (
"aa",
'a', 0, 2, 4);
241 TEST (
"ab",
'a', 0, 1, 4);
242 TEST (
"ab",
'b', 1, 2, 3);
243 TEST (
"bb",
'a', 0, 0, 4);
245 TEST (
"ace",
'a', 0, 1, 5);
246 TEST (
"ace",
'b', 1, 1, 4);
247 TEST (
"ace",
'c', 1, 2, 4);
248 TEST (
"ace",
'd', 2, 2, 4);
249 TEST (
"ace",
'e', 2, 3, 4);
250 TEST (
"ace",
'f', 3, 3, 4);
252 TEST (
"aceg",
'a', 0, 1, 6);
253 TEST (
"aceg",
'b', 1, 1, 5);
254 TEST (
"aceg",
'c', 1, 2, 5);
255 TEST (
"aceg",
'd', 2, 2, 5);
256 TEST (
"aceg",
'e', 2, 3, 5);
257 TEST (
"aceg",
'f', 3, 3, 5);
258 TEST (
"aceg",
'g', 3, 4, 5);
259 TEST (
"aceg",
'h', 4, 4, 5);
278 rw_info (0, 0, 0,
"template <class %s, class %s%{?}, class %s%{;}> "
279 "std::pair<%1$s, %1$s> std::equal_range "
280 "(%1$s, %1$s, const %2$s&%{?}, %s%{;})",
281 "ForwardIterator",
"UserClass",
predicate,
"Compare",
285 rw_note (0, 0, 0,
"ForwardIterator test disabled");
292 rw_note (0, 0, 0,
"BidirectionalIterator test disabled");
299 rw_note (0, 0, 0,
"RandomAccessIterator test disabled");
309run_test (
int,
char*[])
313 if (rw_opt_no_predicate) {
314 rw_note (0, __FILE__, __LINE__,
315 "test of the Predicate form of std::equal_range disabled");
326int main (
int argc,
char *argv[])
328 return rw_test (argc, argv, __FILE__,
333 "|-no-ForwardIterator# "
334 "|-no-BidirectionalIterator# "
335 "|-no-RandomAccessIterator#",
const MyBuffer< char > nsrc[]
#define TEST(str, val, loff, uoff, comp)
void test_equal_range(int line, const char *src_str, char val_char, std::size_t result_loff, std::size_t result_uoff, std::size_t ncomp, const ForwardIterator &it, const T *, bool predicate)
conv_to_bool operator<(const UserClass &lhs, const Y &rhs)
#define _RWSTD_UNUSED(arg)
#define _RWSTD_NAMESPACE(name)
T * make_iter(T *cur, const T *, const T *, T *)
_TEST_EXPORT int rw_test(int argc, char *argv[], const char *filename, const char *clause, const char *comment, int(*testfun)(int, char **), const char *optspec,...)
_TEST_EXPORT int rw_info(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_note(int, const char *, int, const char *,...)
_TEST_EXPORT int rw_assert(int, const char *, int, const char *,...)
static std::size_t funcalls_
bool operator()(const UserClass &lhs, const Y &rhs)
static conv_to_bool make(bool val)