31#if defined (__IBMCPP__) && !defined (_RWSTD_NO_IMPLICIT_INCLUSION)
34# define _RWSTD_NO_IMPLICIT_INCLUSION
54 Y (
int ,
int ): xval_ () { }
96template <
class ForwardIterator>
100 std::size_t result_off,
108 const std::size_t
nsrc = std::strlen (src_str);
111 if (
nsrc < result_off)
122 value.xval_.data_.val_ = val_char;
142 const std::size_t
off = std::size_t (
result.cur_ - xsrc);
145 "lower_bound(%s = \"%s\", ...%{?}%#c%{;}) ==> "
146 "first + %zu, got %zu",
155 "lower_bound(%s = \"%s\", ...%{?}%#c%{;}) complexity: "
156 "invoked predicate at most %zu times, got %zu",
165template <
class ForwardIterator>
170#define TEST(str, val, off, comp) \
171 test_lower_bound (__LINE__, str, val, std::size_t (off), \
172 std::size_t (comp), (ForwardIterator*)0, \
176 "std::lower_bound (%s, %1$s, const UserClass&%{?}, %s%{;})",
186 TEST (
"",
'a', 0, 0);
187 TEST (
"a",
'a', 0, 1);
188 TEST (
"a",
'b', 1, 1);
189 TEST (
"b",
'a', 0, 1);
191 TEST (
"aa",
'a', 0, 2);
192 TEST (
"ab",
'a', 0, 2);
193 TEST (
"ab",
'b', 1, 2);
194 TEST (
"bb",
'a', 0, 2);
196 TEST (
"ace",
'a', 0, 3);
197 TEST (
"ace",
'b', 1, 3);
198 TEST (
"ace",
'c', 1, 3);
199 TEST (
"ace",
'd', 2, 3);
200 TEST (
"ace",
'e', 2, 3);
201 TEST (
"ace",
'f', 3, 3);
203 TEST (
"aceg",
'a', 0, 3);
204 TEST (
"aceg",
'b', 1, 3);
205 TEST (
"aceg",
'c', 1, 3);
206 TEST (
"aceg",
'd', 2, 3);
207 TEST (
"aceg",
'e', 2, 3);
208 TEST (
"aceg",
'f', 3, 3);
209 TEST (
"aceg",
'g', 3, 3);
210 TEST (
"aceg",
'h', 4, 3);
224 rw_info (0, 0, 0,
"template <class %s, class %s%{?}, class %s%{;}> "
225 "std::lower_bound (%1$s, %1$s, const UserClass&%{?}, %4$s%{;})",
228 if (rw_opt_no_fwd_iter) {
229 rw_note (0, 0, 0,
"ForwardIterator test disabled");
235 if (rw_opt_no_bidir_iter) {
236 rw_note (0, 0, 0,
"BidirectionalIterator test disabled");
243 if (rw_opt_no_fwd_iter) {
244 rw_note (0, 0, 0,
"RandomAccessIterator test disabled");
259 if (rw_opt_no_predicate) {
260 rw_note (0, __FILE__, __LINE__,
261 "test of the Predicate form of std::lower_bound disabled");
272int main (
int argc,
char *argv[])
274 return rw_test (argc, argv, __FILE__,
279 "|-no-ForwardIterator# "
280 "|-no-BidirectionalIterator# "
281 "|-no-RandomAccessIterator#",
const MyBuffer< char > nsrc[]
void run_test(const ForwardIterator &dummy, T *, Predicate *pred)
#define TEST(str, val, off, comp)
void test_lower_bound(int line, const char *src_str, char val_char, std::size_t result_off, std::size_t ncomp, const ForwardIterator *, const char *itname, bool predicate)
conv_to_bool operator<(const UserClass &lhs, const Y &rhs)
#define _RWSTD_UNUSED(arg)
_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 UserClass from_char(char c)
static _RWSTD_SIZE_T n_total_op_lt_
static conv_to_bool make(bool val)