36#ifndef _RWSTD_NO_EXCEPTIONS
49 if (count_ + 1 == throw_at_)
56 if (count_ + 1 == throw_at_)
68 void operator= (
const Y&);
80const char*
type_name (
volatile T*,
T*) {
return "volatile T*"; }
83const char*
type_name (
const volatile T*,
T*) {
return "const volatile T*"; }
87inline const volatile int*
88make_iter (
const int *beg,
const int*,
const int*,
const volatile int*)
104template <
class InputIterator,
class ForwardIterator>
108 const char*
const i1name =
type_name (dummy, (
int*)0);
111 rw_info (0, 0, __LINE__,
"std::uninitialized_copy(%s, %1$s, %s)",
114 static const int a[] = {
115 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
118 const unsigned N =
sizeof a /
sizeof *
a;
123 for (
unsigned i = 0;
i !=
N; ++
i) {
125 Y::count_ = Y::ctor_ = Y::dtor_ = 0;
140 std::uninitialized_copy (first,
last,
result);
143 "%zu. expected exception not thrown",
i);
150 "%zu. exception of an unexpected type thrown",
i);
155 "%zu. %d elements not destroyed",
i, Y::count_);
158 rw_assert (Y::ctor_ == Y::throw_at_, 0, __LINE__,
159 "%zu. %d ctor calls expected, got %d",
160 i, Y::throw_at_, Y::ctor_);
161 rw_assert (
i ? Y::dtor_ + 1 == Y::throw_at_ :
true, 0, __LINE__,
162 "%zu. %d dtor calls expected, got %d",
163 i, Y::throw_at_ - 1, Y::dtor_);
166 ::operator
delete (
buf);
175template <
class ForwardIterator>
181 "std::uninitialized_fill%{?}_n%{;}(%s, %{?}size_t%{:}%2$s%{;}, "
182 "const int&)", test_count, itname, test_count);
184 const unsigned N = 32;
189 for (
unsigned i = 0;
i !=
N; ++
i) {
197 Y::count_ = Y::ctor_ = Y::dtor_ = 0;
208 std::uninitialized_fill_n (first,
i,
val);
214 std::uninitialized_fill (first,
last,
val);
218 "%zu. expected exception not thrown",
i);
225 "%zu. exception of an unexpected type thrown",
i);
230 "%zu. %d elements not destroyed",
i, Y::count_);
233 rw_assert (Y::ctor_ == Y::throw_at_, 0, __LINE__,
234 "%zu. %d ctor calls expected, got %d",
235 i, Y::throw_at_, Y::ctor_);
236 rw_assert (
i ? Y::dtor_ + 1 == Y::throw_at_ :
true, 0, __LINE__,
237 "%d. %d dtor calls expected, got %d",
238 i, Y::throw_at_ - 1, Y::dtor_);
241 ::operator
delete (
buf);
257template <
class InputIterator>
264 "ForwardIterator tests disabled");
270 "BidirectionalIterator tests disabled");
276 "RandomAccessIterator tests disabled");
279 typedef volatile Y* VolatilePointer;
284 "volatile T* tests disabled");
292 typedef const volatile int* ConstVolatilePointer;
293 typedef volatile Y* VolatilePointer;
300 "InputIterator tests disabled");
306 "ForwardIterator tests disabled");
312 "BidirectionalIterator tests disabled");
318 "RandomAccessIterator tests disabled");
324 "volatile T* tests disabled");
327 rw_note (0, 0, 0,
"tests of std::uninitialized_copy disabled");
336 "ForwardIterator tests disabled");
342 "BidirectionalIterator tests disabled");
348 "RandomAccessIterator tests disabled");
355 0, 0,
"volatile T* tests disabled");
358 rw_note (0, 0, 0,
"tests of std::uninitialized_fill disabled");
366 "ForwardIterator tests disabled");
372 "BidirectionalIterator tests disabled");
378 "RandomAccessIterator tests disabled");
385 "volatile T* tests disabled");
388 rw_note (0, 0, 0,
"tests of std::uninitialized_fill disabled");
399 "exceptions disabled (_RWSTD_NO_EXCEPTIONS #defined), "
409int main (
int argc,
char *argv[])
411 return rw_test (argc, argv, __FILE__,
412 "lib.specialized.algorithms",
415 "|-uninitialized_copy~ "
416 "|-uninitialized_fill~ "
417 "|-uninitialized_fill_n~ "
419 "|-ForwardIterator~ "
420 "|-BidirectionalIterator~ "
421 "|-RandomAccessIterator~ "
422 "|-volatile-pointer",
void test_uninitialized_copy(const InputIterator &dummy, const ForwardIterator *)
const volatile int * make_iter(const int *beg, const int *, const int *, const volatile int *)
void test_uninitialized_fill(const ForwardIterator *, bool test_count)
void run_test(const ForwardIterator &dummy, T *, Predicate *pred)
#define _RWSTD_STATIC_CAST(T, x)
_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 *,...)