Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 58327 invoked from network); 21 Feb 2007 15:59:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Feb 2007 15:59:24 -0000 Received: (qmail 24864 invoked by uid 500); 21 Feb 2007 15:59:32 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 24845 invoked by uid 500); 21 Feb 2007 15:59:32 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 24834 invoked by uid 99); 21 Feb 2007 15:59:32 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Feb 2007 07:59:32 -0800 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Feb 2007 07:59:18 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 13CD81A9822; Wed, 21 Feb 2007 07:58:58 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r510071 [3/5] - in /incubator/stdcxx/trunk/tests: algorithms/ containers/ include/ numerics/ self/ src/ utilities/ Date: Wed, 21 Feb 2007 15:58:56 -0000 To: stdcxx-commits@incubator.apache.org From: faridz@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070221155858.13CD81A9822@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/stdcxx/trunk/tests/algorithms/25.set.union.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/algorithms/25.set.union.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/algorithms/25.set.union.cpp (original) +++ incubator/stdcxx/trunk/tests/algorithms/25.set.union.cpp Wed Feb 21 07:58:53 2007 @@ -6,16 +6,23 @@ * *************************************************************************** * - * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave - * Software division. Licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. Unless required by - * applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License - * for the specific language governing permissions and limitations under - * the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ @@ -23,6 +30,7 @@ #include // for size_t #include +#include // for UserClass #include // for rw_test() /**************************************************************************/ @@ -66,7 +74,8 @@ // return a type other than bool but one that is implicitly // convertible to bool to detect incorrect assumptions - conv_to_bool operator() (const X &x, const X &y) /* non-const */ { + conv_to_bool operator() (const UserClass &x, + const UserClass &y) /* non-const */ { ++funcalls_; return conv_to_bool::make (x.val_ < y.val_); } @@ -87,24 +96,25 @@ const char* iter_names [3]; // pure virtual, must be overridden - virtual X* - set_union (const X*, const X*, const X*, const X*, - X*, X*, const Less*) const = 0; + virtual UserClass* + set_union (const UserClass*, const UserClass*, const UserClass*, + const UserClass*, UserClass*, UserClass*, + const Less*) const = 0; }; template struct SetUnion: SetUnionBase { SetUnion () { - iter_names [0] = type_name (InputIterator1 (0, 0, 0), (X*)0); - iter_names [1] = type_name (InputIterator2 (0, 0, 0), (X*)0); - iter_names [2] = type_name (OutputIterator (0, 0, 0), (X*)0); + iter_names [0] = type_name (InputIterator1 (0, 0, 0), (UserClass*)0); + iter_names [1] = type_name (InputIterator2 (0, 0, 0), (UserClass*)0); + iter_names [2] = type_name (OutputIterator (0, 0, 0), (UserClass*)0); } - virtual X* - set_union (const X *xsrc1, const X *xsrc1_end, - const X *xsrc2, const X *xsrc2_end, - X *xdst, X *xdst_end, + virtual UserClass* + set_union (const UserClass *xsrc1, const UserClass *xsrc1_end, + const UserClass *xsrc2, const UserClass *xsrc2_end, + UserClass *xdst, UserClass *xdst_end, const Less *ppred) const { const InputIterator1 first1 (xsrc1, xsrc1, xsrc1_end); @@ -144,26 +154,28 @@ const char* const fname = "set_union"; const char* const funname = predicate ? "Less" : 0; - X* const xsrc1 = X::from_char (src1, nsrc1, true /* must be sorted */); - X* const xsrc2 = X::from_char (src2, nsrc2, true /* must be sorted */); + UserClass* const xsrc1 = UserClass::from_char (src1, nsrc1, + true /* must be sorted */); + UserClass* const xsrc2 = UserClass::from_char (src2, nsrc2, + true /* must be sorted */); // assert that the sequences have been successfully created RW_ASSERT (0 == nsrc1 || xsrc1); RW_ASSERT (0 == nsrc2 || xsrc2); - X* const xdst = new X [ndst]; + UserClass* const xdst = new UserClass [ndst]; const int max1_id = nsrc1 > 0 ? xsrc1 [nsrc1 - 1].id_ : -1; - X* const xsrc1_end = xsrc1 + nsrc1; - X* const xsrc2_end = xsrc2 + nsrc2; - X* const xdst_end = xdst + ndst; + UserClass* const xsrc1_end = xsrc1 + nsrc1; + UserClass* const xsrc2_end = xsrc2 + nsrc2; + UserClass* const xdst_end = xdst + ndst; - const std::size_t last_n_op_lt = X::n_total_op_lt_; + const std::size_t last_n_op_lt = UserClass::n_total_op_lt_; const Less pred (0, 0); const Less* const ppred = predicate ? &pred : 0; - const X* const xdst_res = + const UserClass* const xdst_res = alg.set_union (xsrc1, xsrc1_end, xsrc2, xsrc2_end, xdst, xdst_end, ppred); @@ -184,7 +196,7 @@ } const std::size_t n_ops_lt = ppred ? - Less::funcalls_ : X::n_total_op_lt_ - last_n_op_lt; + Less::funcalls_ : UserClass::n_total_op_lt_ - last_n_op_lt; // check the algorithm correctness std::size_t i = 0; @@ -319,13 +331,15 @@ bool predicate) { if (0 == rw_opt_no_output_iter) - gen_set_union_test (it1, it2, OutputIter(0, 0, 0), predicate); + gen_set_union_test (it1, it2, OutputIter(0, 0, 0), + predicate); if (0 == rw_opt_no_fwd_iter) - gen_set_union_test (it1, it2, FwdIter(0, 0, 0), predicate); + gen_set_union_test (it1, it2, FwdIter(0, 0, 0), predicate); if (0 == rw_opt_no_bidir_iter) - gen_set_union_test (it1, it2, BidirIter(0, 0, 0), predicate); + gen_set_union_test (it1, it2, BidirIter(0, 0, 0), predicate); if (0 == rw_opt_no_rnd_iter) - gen_set_union_test (it1, it2, RandomAccessIter(0, 0, 0), predicate); + gen_set_union_test (it1, it2, RandomAccessIter(0, 0, 0), + predicate); } template @@ -333,13 +347,14 @@ bool predicate) { if (0 == rw_opt_no_input_iter) - gen_set_union_test (it1, InputIter(0, 0, 0), predicate); + gen_set_union_test (it1, InputIter(0, 0, 0), predicate); if (0 == rw_opt_no_fwd_iter) - gen_set_union_test (it1, ConstFwdIter(0, 0, 0), predicate); + gen_set_union_test (it1, ConstFwdIter(0, 0, 0), predicate); if (0 == rw_opt_no_bidir_iter) - gen_set_union_test (it1, ConstBidirIter(0, 0, 0), predicate); + gen_set_union_test (it1, ConstBidirIter(0, 0, 0), predicate); if (0 == rw_opt_no_rnd_iter) - gen_set_union_test (it1, ConstRandomAccessIter(0, 0, 0), predicate); + gen_set_union_test (it1, ConstRandomAccessIter(0, 0, 0), + predicate); } // generates a specialization of the set_union test for each of the required @@ -358,22 +373,23 @@ if (rw_opt_no_input_iter) rw_note (0, 0, 0, "InputIterator test disabled"); else - gen_set_union_test (InputIter(0, 0, 0), predicate); + gen_set_union_test (InputIter(0, 0, 0), predicate); if (rw_opt_no_fwd_iter) rw_note (0, 0, 0, "ForwardIterator test disabled"); else - gen_set_union_test (ConstFwdIter(0, 0, 0), predicate); + gen_set_union_test (ConstFwdIter(0, 0, 0), predicate); if (rw_opt_no_bidir_iter) rw_note (0, 0, 0, "BidirectionalIterator test disabled"); else - gen_set_union_test (ConstBidirIter(0, 0, 0), predicate); + gen_set_union_test (ConstBidirIter(0, 0, 0), predicate); if (rw_opt_no_rnd_iter) rw_note (0, 0, 0, "RandomAccessIterator test disabled"); else - gen_set_union_test (ConstRandomAccessIter(0, 0, 0), predicate); + gen_set_union_test (ConstRandomAccessIter(0, 0, 0), + predicate); } /**************************************************************************/ Modified: incubator/stdcxx/trunk/tests/algorithms/25.sort.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/algorithms/25.sort.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/algorithms/25.sort.cpp (original) +++ incubator/stdcxx/trunk/tests/algorithms/25.sort.cpp Wed Feb 21 07:58:53 2007 @@ -6,16 +6,23 @@ * *************************************************************************** * - * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave - * Software division. Licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. Unless required by - * applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License - * for the specific language governing permissions and limitations under - * the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ @@ -24,6 +31,7 @@ #include // for ptrdiff_t #include +#include // for UserClass #include // for rw_test() /**************************************************************************/ @@ -126,7 +134,7 @@ _RWSTD_UNUSED (last_n_op_cpy); if (stable) { - std::pair dummy; + std::pair dummy; if (alloc) { dummy = std::_GET_TEMP_BUFFER (T, nsrc + 1); rw_assert (0 != dummy.first, 0, 0, @@ -174,7 +182,8 @@ if (nsrc > 16 && x < x_min) x_min = x; - // complexity: X * N * log (N), ideally with X approaching 1 + // complexity: UserClass * N * log (N), + // ideally with UserClass approaching 1 if (!(nsrc % 20)) { rw_info (0, 0, 0, @@ -182,7 +191,7 @@ "| N | COMP | COPY |N lg N| X | max X| min X|\n" "+======+======+======+======+======+======+======+\n"); - // # | comp | assign | exp. complexity | X | max X | + // # | comp | assign | exp. complexity | X | max X | min X rw_info (0, 0, 0, "\n|%6d|%6d|%6d|%6d|%6.2f|%6.2f|%6.2f|\n", nsrc + 1, ops, cpy, cmplx, x, x_max, x_min); } @@ -372,16 +381,16 @@ rw_note (0, __FILE__, __LINE__, "std::sort test disabled"); } else { - test_sort (N, (X*)0, false, false); + test_sort (N, (UserClass*)0, false, false); } if (rw_opt_no_stable_sort) { rw_note (0, __FILE__, __LINE__, "std::stable_sort test disabled"); } else { - test_sort (N, (X*)0, true, false); + test_sort (N, (UserClass*)0, true, false); // test with memory reallocation - test_sort (N, (X*)0, true, true); + test_sort (N, (UserClass*)0, true, true); } return 0; Modified: incubator/stdcxx/trunk/tests/algorithms/25.swap.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/algorithms/25.swap.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/algorithms/25.swap.cpp (original) +++ incubator/stdcxx/trunk/tests/algorithms/25.swap.cpp Wed Feb 21 07:58:53 2007 @@ -6,16 +6,23 @@ * *************************************************************************** * - * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave - * Software division. Licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. Unless required by - * applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License - * for the specific language governing permissions and limitations under - * the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ @@ -23,6 +30,7 @@ #include // for size_t, strlen() #include +#include // for UserClass #include // for rw_test() @@ -105,8 +113,8 @@ void test_iter_swap (ForwardIterator1 it1, ForwardIterator2 it2, const T*, bool it_swap) { - const char* const it1name = it_swap ? type_name (it1, (T*)0) : "X"; - const char* const it2name = it_swap ? type_name (it2, (T*)0) : "X"; + const char* const it1name = it_swap ? type_name (it1, (T*)0) : "UserClass"; + const char* const it2name = it_swap ? type_name (it2, (T*)0) : "UserClass"; const char* const fname = it_swap ? "iter_swap" : "swap"; rw_info (0, 0, 0, "std::%s (%s, %s)", fname, it1name, it2name); @@ -325,7 +333,8 @@ else { rw_info (0, 0, 0, "template void swap (T&, T&)"); - test_iter_swap (FwdIter(), FwdIter(), (X*)0, false); + test_iter_swap (FwdIter(), FwdIter(), + (UserClass*)0, false); } if (rw_opt_no_swap_ranges) { @@ -337,7 +346,7 @@ "swap_ranges (%1$s, %1$s, %2$s)", "ForwardIterator1", "ForwardIterator2"); - test_swap ((X*)0, true); + test_swap ((UserClass*)0, true); } if (rw_opt_no_iter_swap) { @@ -348,7 +357,7 @@ "template void iter_swap (%1$s, %2$s)", "ForwardIterator1", "ForwardIterator2"); - test_swap ((X*)0, false); + test_swap ((UserClass*)0, false); } return 0; Modified: incubator/stdcxx/trunk/tests/algorithms/25.transform.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/algorithms/25.transform.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/algorithms/25.transform.cpp (original) +++ incubator/stdcxx/trunk/tests/algorithms/25.transform.cpp Wed Feb 21 07:58:53 2007 @@ -6,16 +6,23 @@ * *************************************************************************** * - * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave - * Software division. Licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. Unless required by - * applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License - * for the specific language governing permissions and limitations under - * the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ @@ -23,6 +30,7 @@ #include // for size_t #include +#include // for UserClass #include // for rw_test() @@ -128,7 +136,7 @@ OutputIterator invoke_transform (InputIterator first, InputIterator last, Unused /* for compatibility with the overload below */, - OutputIterator dest, incT fun) + OutputIterator dest, incT fun) { return std::transform (first, last, dest, fun); } @@ -137,7 +145,7 @@ OutputIterator invoke_transform (InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, - OutputIterator dest, plusT fun) + OutputIterator dest, plusT fun) { return std::transform (first1, last1, first2, dest, fun); } @@ -271,11 +279,11 @@ int tag3, int same_seq) { - const InputIter input_iter (0, 0, 0); + const InputIter input_iter (0, 0, 0); const OutputIter output_iter (0, 0, 0); const FwdIter fwd_iter (0, 0, 0); const BidirIter bidir_iter (0, 0, 0); - const RandomAccessIter rand_iter (0, 0, 0); + const RandomAccessIter rand_iter (0, 0, 0); // tag1, tag2 and tag3 indicates that an iterator needs to be generated // at the corresponding position by a recursive call to gen_test @@ -412,9 +420,9 @@ static int run_test (int, char*[]) { - const InputIter input_iter (0, 0, 0); - const RandomAccessIter rand_iter; - const X* const ptr = 0; + const InputIter input_iter (0, 0, 0); + const RandomAccessIter rand_iter; + const UserClass* const ptr = 0; // test transform with a unary function // according to 25.2.3 p5 'result may be equal to first' @@ -424,7 +432,7 @@ "std::transform unary function test disabled"); } else { - const incT* const pfun = 0; + const incT* const pfun = 0; gen_test (ptr, input_iter, rand_iter, rand_iter, pfun, 1, 0, 1, 0 /* result distinct from first */); @@ -444,7 +452,7 @@ "std::transform binary function test disabled"); } else { - const plusT* const pfun = 0; + const plusT* const pfun = 0; gen_test (ptr, input_iter, rand_iter, rand_iter, pfun, 1, 1, 1, 0 /* result distinct from first{1,2} */); Modified: incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp (original) +++ incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp Wed Feb 21 07:58:53 2007 @@ -6,29 +6,31 @@ * *************************************************************************** * - * Copyright 2006 The Apache Software Foundation or its licensors, - * as applicable. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at * - * Copyright 2000-2006 Rogue Wave Software. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 2000-2006 Rogue Wave Software. * **************************************************************************/ #include // for unique, unique_copy #include // for strlen -#include // for BinaryPredicate, X +#include // for BinaryPredicate +#include // for UserClass #include // for rw_test() /**************************************************************************/ @@ -351,14 +353,14 @@ rw_note (0, __FILE__, __LINE__, "std::unique test disabled"); } else { - test_unique ((X*)0, (BinaryPredicate*)0, false); + test_unique ((UserClass*)0, (BinaryPredicate*)0, false); if (rw_opt_no_predicate) { rw_note (0, __FILE__, __LINE__, "std::unique predicate test disabled"); } else { - test_unique ((X*)0, &pred, false); + test_unique ((UserClass*)0, &pred, false); } } @@ -366,14 +368,14 @@ rw_note (0, __FILE__, __LINE__, "std::unique_copy test disabled"); } else { - test_unique ((X*) 0, (BinaryPredicate*)0, true); + test_unique ((UserClass*) 0, (BinaryPredicate*)0, true); if (rw_opt_no_predicate) { rw_note (0, __FILE__, __LINE__, "std::unique_copy predicate test disabled"); } else { - test_unique ((X*)0, &pred, true); + test_unique ((UserClass*)0, &pred, true); } } Modified: incubator/stdcxx/trunk/tests/algorithms/25.upper.bound.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/algorithms/25.upper.bound.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/algorithms/25.upper.bound.cpp (original) +++ incubator/stdcxx/trunk/tests/algorithms/25.upper.bound.cpp Wed Feb 21 07:58:53 2007 @@ -6,16 +6,23 @@ * *************************************************************************** * - * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave - * Software division. Licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. Unless required by - * applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License - * for the specific language governing permissions and limitations under - * the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ @@ -31,16 +38,17 @@ #include // for strlen() #include // for iterators +#include // for UserClass #include // for rw_test(), ... /**************************************************************************/ -// distinct and not Less-Than-Comparable with class X (except as +// distinct and not Less-Than-Comparable with class UserClass (except as // defined below) to detect unwarranted assumptions made by the // implementation of the algorithms struct Y { - X xval_; + UserClass xval_; // not Default-Constructible Y (int /* dummy */, int /*dummy */): xval_ () { } @@ -55,13 +63,13 @@ inline conv_to_bool -operator< (const X &lhs, const Y &rhs) +operator< (const UserClass &lhs, const Y &rhs) { return conv_to_bool::make (lhs < rhs.xval_); } inline conv_to_bool -operator< (const Y &lhs, const X &rhs) +operator< (const Y &lhs, const UserClass &rhs) { return conv_to_bool::make (lhs.xval_ < rhs); } @@ -77,12 +85,12 @@ // return a type other than bool but one that is implicitly // convertible to bool to detect incorrect assumptions - conv_to_bool operator() (const X &lhs, const Y &rhs) { + conv_to_bool operator() (const UserClass &lhs, const Y &rhs) { ++funcalls_; return conv_to_bool::make (lhs < rhs.xval_); } - conv_to_bool operator() (const Y &lhs, const X &rhs) { + conv_to_bool operator() (const Y &lhs, const UserClass &rhs) { ++funcalls_; return conv_to_bool::make (lhs.xval_ < rhs); } @@ -108,7 +116,7 @@ RW_ASSERT (0 != src_str); const std::size_t nsrc = std::strlen (src_str); - X* const xsrc = X::from_char (src_str, nsrc); + UserClass* const xsrc = UserClass::from_char (src_str, nsrc); if (nsrc < result_off) result_off = nsrc; @@ -127,8 +135,8 @@ // when `predicate' is true const LessThan comp (0, 0 /* dummy arguments */); - // reset the counter of invocations of X::operator<() - X::n_total_op_lt_ = 0; + // reset the counter of invocations of UserClass::operator<() + UserClass::n_total_op_lt_ = 0; // invoke the appropriate form of the algorithm, storing // the resturned value @@ -151,7 +159,7 @@ // verify complexity const std::size_t funcalls = predicate - ? LessThan::funcalls_ : X::n_total_op_lt_; + ? LessThan::funcalls_ : UserClass::n_total_op_lt_; rw_assert (funcalls <= ncomp, 0, line, "upper_bound(%s = \"%s\", ...%{?}%#c%{;}) complexity: " @@ -174,7 +182,8 @@ std::size_t (comp), (ForwardIterator*)0, \ itname, predicate) - rw_info (0, 0, 0, "std::upper_bound (%s, %1$s, const X&%{?}, %s%{;})", + rw_info (0, 0, 0, + "std::upper_bound (%s, %1$s, const UserClass&%{?}, %s%{;})", itname, predicate, "LessThan"); // +--------------- source sequence @@ -223,28 +232,30 @@ test_upper_bound (bool predicate) { rw_info (0, 0, 0, "template " - "std::upper_bound (%1$s, %1$s, const X&%{?}, %4$s%{;})", - "ForwardIterator", "X", predicate, "Compare", predicate); + "std::upper_bound (%1$s, %1$s, const UserClass&%{?}, %4$s%{;})", + "ForwardIterator", "UserClass", predicate, "Compare", predicate); if (rw_opt_no_fwd_iter) { rw_note (0, 0, 0, "ForwardIterator test disabled"); } else { - test_upper_bound ((FwdIter*)0, "ForwardIterator", predicate); + test_upper_bound ((FwdIter*)0, "ForwardIterator", predicate); } if (rw_opt_no_bidir_iter) { rw_note (0, 0, 0, "BidirectionalIterator test disabled"); } else { - test_upper_bound ((BidirIter*)0, "BidirectionalIterator", predicate); + test_upper_bound ((BidirIter*)0, "BidirectionalIterator", + predicate); } if (rw_opt_no_fwd_iter) { rw_note (0, 0, 0, "RandomAccessIterator test disabled"); } else { - test_upper_bound ((RandomAccessIter*)0, "RandomAccessIterator", + test_upper_bound ((RandomAccessIter*)0, + "RandomAccessIterator", predicate); } } Modified: incubator/stdcxx/trunk/tests/containers/23.deque.modifiers.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/containers/23.deque.modifiers.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/containers/23.deque.modifiers.cpp (original) +++ incubator/stdcxx/trunk/tests/containers/23.deque.modifiers.cpp Wed Feb 21 07:58:53 2007 @@ -6,16 +6,23 @@ * *************************************************************************** * - * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave - * Software division. Licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. Unless required by - * applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License - * for the specific language governing permissions and limitations under - * the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ @@ -39,7 +46,7 @@ # include #endif // _RWSTD_NO_REPLACEABLE_NEW_DELETE -#include // for X +#include // for UserClass #include // for rw_test(), ... #include // for rw_asnprintf @@ -63,7 +70,7 @@ /**************************************************************************/ -typedef std::deque > Deque; +typedef std::deque > Deque; Deque::size_type new_capacity; @@ -114,18 +121,18 @@ // by throwing an exception; verifies that the exception had no effects // on the container template -void exception_loop (int line /* line number in caller*/, - MemberFunction mfun /* deque member function */, - const char *fcall /* function call string */, - int exceptions /* enabled exceptions */, - Deque &deq /* container to call function on */, +void exception_loop (int line /* line number in caller*/, + MemberFunction mfun /* deque member function */, + const char *fcall /* function call string */, + int exceptions /* enabled exceptions */, + Deque &deq /* container to call function on */, const Deque::iterator &it /* iterator into container */, - int n /* number of elements or offset */, - const X *x /* pointer to an element or 0 */, - const Iterator &first /* beginning of range */, - const Iterator &last /* end of range to insert */, - int *n_copy /* number of copy ctors */, - int *n_asgn /* number of assignments */) + int n /* number of elements or offset */, + const UserClass *x /* pointer to an element or 0 */, + const Iterator &first /* beginning of range */, + const Iterator &last /* end of range to insert */, + int *n_copy /* number of copy ctors */, + int *n_asgn /* number of assignments */) { std::size_t throw_after = 0; @@ -147,13 +154,13 @@ for ( ; ; ) { // detect objects constructed but not destroyed after an exception - std::size_t x_count = X::count_; + std::size_t x_count = UserClass::count_; _RWSTD_ASSERT (n_copy); _RWSTD_ASSERT (n_asgn); - *n_copy = X::n_total_copy_ctor_; - *n_asgn = X::n_total_op_assign_; + *n_copy = UserClass::n_total_copy_ctor_; + *n_asgn = UserClass::n_total_op_assign_; #ifndef _RWSTD_NO_EXCEPTIONS @@ -170,11 +177,13 @@ # endif // DEFINE_REPLACEMENT_NEW_AND_DELETE if (exceptions & CopyCtorThrows) { - X::copy_ctor_throw_count_ = X::n_total_copy_ctor_ + throw_after; + UserClass::copy_ctor_throw_count_ = + UserClass::n_total_copy_ctor_ + throw_after; } if (exceptions & AssignmentThrows) { - X::op_assign_throw_count_ = X::n_total_op_assign_ + throw_after; + UserClass::op_assign_throw_count_ = + UserClass::n_total_op_assign_ + throw_after; } #endif // _RWSTD_NO_EXCEPTIONS @@ -234,7 +243,7 @@ // count the number of objects to detect leaks - x_count = X::count_ - x_count; + x_count = UserClass::count_ - x_count; rw_assert (x_count == deq.size () - size, 0, line, "line %d: %s: leaked %zu objects after an exception", __LINE__, fcall, x_count - (deq.size () - size)); @@ -252,7 +261,7 @@ } // count the number of objects to detect leaks - x_count = X::count_ - x_count; + x_count = UserClass::count_ - x_count; rw_assert (x_count == deq.size () - size, 0, line, "line %d: %s: leaked %zu objects " "after a successful insertion", @@ -268,13 +277,13 @@ #endif // DEFINE_REPLACEMENT_NEW_AND_DELETE - X::copy_ctor_throw_count_ = 0; - X::op_assign_throw_count_ = 0; + UserClass::copy_ctor_throw_count_ = 0; + UserClass::op_assign_throw_count_ = 0; - // compute the number of calls to X copy ctor and assignment operator - // and set `n_copy' and `n_assgn' to the value of the result - *n_copy = X::n_total_copy_ctor_ - *n_copy; - *n_asgn = X::n_total_op_assign_ - *n_asgn; + // compute the number of calls to UserClass copy ctor and assignment + // operator and set `n_copy' and `n_assgn' to the value of the result + *n_copy = UserClass::n_total_copy_ctor_ - *n_copy; + *n_asgn = UserClass::n_total_op_assign_ - *n_asgn; } @@ -323,8 +332,8 @@ const char *res, std::size_t reslen) { // Ensure that xsrc, xins are always dereferenceable - const X* const xseq = X::from_char (seq, seqlen + 1); - X* const xins = X::from_char (ins, inslen + 1); + const UserClass* const xseq = UserClass::from_char (seq, seqlen + 1); + UserClass* const xins = UserClass::from_char (ins, inslen + 1); Deque deq = seqlen ? Deque (xseq, xseq + seqlen) : Deque (); @@ -350,8 +359,8 @@ nelems == -2, *ins, nelems == -1, int (inslen), -1, xins, nelems, *ins); - int n_copy = X::n_total_copy_ctor_; - int n_asgn = X::n_total_op_assign_; + int n_copy = UserClass::n_total_copy_ctor_; + int n_asgn = UserClass::n_total_op_assign_; if (-2 == nelems) { // insert(iterator, const_reference) @@ -423,7 +432,7 @@ rw_assert (n_copy == int (expect_copy), __FILE__, line, "line %d: %s: expected %zu invocations " - "of X::X(const X&), got %d\n", + "of UserClass::UserClass(const UserClass&), got %d\n", __LINE__, funcall, expect_copy, n_copy); // compute the number of calls to the assignment operator @@ -433,7 +442,7 @@ rw_assert (n_asgn == int (expect_asgn), __FILE__, line, "line %d: %s: expected %zu invocations " - "of X::operator=(const X&), got %d\n", + "of UserClass::operator=(const UserClass&), got %d\n", __LINE__, funcall, expect_asgn, n_asgn); // Free funcall storage @@ -449,7 +458,7 @@ void test_insert_range (const Iterator &it, const char* itname) { rw_info (0, 0 ,0, - "std::deque::insert(iterator, %s, %s)", itname, itname); + "std::deque::insert(iterator, %s, %s)", itname, itname); #undef TEST #define TEST(seq, off, ins, res) \ @@ -604,13 +613,14 @@ ////////////////////////////////////////////////////////////////// // exercise deque::insert(iterator, const_reference) - rw_info (0, 0, 0, "std::deque::insert(iterator, const_reference)"); + rw_info (0, 0, 0, + "std::deque::insert(iterator, const_reference)"); #undef TEST #define TEST(seq, off, ins, res) do { \ const char insseq [] = { ins, '\0' }; \ test_insert (__LINE__, -1, \ - (X*)0, -2, \ + (UserClass*)0, -2, \ seq, sizeof seq - 1, \ std::size_t (off), \ insseq, 1, \ @@ -725,14 +735,14 @@ // exercise deque::insert(iterator, size_type, const_reference) rw_info (0, 0, 0, - "std::deque::insert(iterator, size_type, " + "std::deque::insert(iterator, size_type, " "const_reference)"); #undef TEST #define TEST(seq, off, n, ins, res) do { \ const char insseq [] = { ins, '\0' }; \ test_insert (__LINE__, -1, \ - (X*)0, n, \ + (UserClass*)0, n, \ seq, sizeof seq - 1, \ std::size_t (off), \ insseq, 1, \ @@ -763,39 +773,41 @@ // exercise deque::insert(iterator, InputIterator, InputIterator) rw_info (0, 0, 0, - "template std::deque::" + "template std::deque::" "insert(iterator, InputIterator, InputIterator)"); if (0 == rw_opt_no_input_iterator) - test_insert_range (InputIter(0, 0, 0), "InputIter"); + test_insert_range (InputIter(0, 0, 0), + "InputIter"); else rw_note (0, 0, __LINE__, "template " - "std::deque::insert(iterator, T, T) " + "std::deque::insert(iterator, T, T) " "[with T = InputIterator] test disabled."); if (0 == rw_opt_no_forward_iterator) - test_insert_range (FwdIter(), "FwdIter"); + test_insert_range (FwdIter(), "FwdIter"); else rw_note (0, 0, __LINE__, "template " - "std::deque::insert(iterator, T, T) " + "std::deque::insert(iterator, T, T) " "[with T = ForwardIterator] test disabled."); if (0 == rw_opt_no_bidirectional_iterator) - test_insert_range (BidirIter(), "BidirIter"); + test_insert_range (BidirIter(), "BidirIter"); else rw_note (0, 0, __LINE__, "template " - "std::deque::insert(iterator, T, T) " + "std::deque::insert(iterator, T, T) " "[with T = BidirectionalIterator] test disabled."); if (0 == rw_opt_no_random_iterator) - test_insert_range (RandomAccessIter(), "RandomAccessIter"); + test_insert_range (RandomAccessIter(), + "RandomAccessIter"); else rw_note (0, 0, __LINE__, "template " - "std::deque::insert(iterator, T, T) " + "std::deque::insert(iterator, T, T) " "[with T = RandomAccessIterator] test disabled."); ////////////////////////////////////////////////////////////////// @@ -828,7 +840,7 @@ else rw_note (0, 0, __LINE__, "template " - "std::deque::insert(iterator, T, T) " + "std::deque::insert(iterator, T, T) " "[with T = IntegralType] tests disabled."); } @@ -842,8 +854,8 @@ const char *asn, std::size_t asnlen, const char *res, std::size_t reslen) { - const X* const xseq = X::from_char (seq, seqlen + 1); - X* const xasn = X::from_char (asn, asnlen + 1); + const UserClass* const xseq = UserClass::from_char (seq, seqlen + 1); + UserClass* const xasn = UserClass::from_char (asn, asnlen + 1); Deque deq = seqlen ? Deque (xseq, xseq + seqlen) : Deque (); @@ -860,8 +872,8 @@ asnlen, -1, xasn, nelems, *asn); - int n_copy = X::n_total_copy_ctor_; - int n_asgn = X::n_total_op_assign_; + int n_copy = UserClass::n_total_copy_ctor_; + int n_asgn = UserClass::n_total_op_assign_; // create a dummy deque iterator to pass to exception_loop // (the object will not be used by the functiuon) @@ -953,12 +965,12 @@ rw_assert (n_copy == int (expect_copy), 0, line, "line %d: %s: expected %zu invocations " - "of X::X(const X&), got %d\n", + "of UserClass::UserClass(const UserClass&), got %d\n", __LINE__, funcall, expect_copy, n_copy); rw_assert (n_asgn == int (expect_asgn), 0, line, "line %d: %s: expected %zu invocations " - "of X::operator=(const X&), got %d\n", + "of UserClass::operator=(const UserClass&), got %d\n", __LINE__, funcall, expect_asgn, n_asgn); // Free funcall storage @@ -972,7 +984,7 @@ template void test_assign_range (const Iterator &it, const char* itname) { - rw_info (0, 0, 0, "std::deque::assign(%s, %s)", itname, itname); + rw_info (0, 0, 0, "std::deque::assign(%s, %s)", itname, itname); static const char seq[] = "abcdefghijklmnopqrstuvwxyz"; static const char asn[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -992,7 +1004,8 @@ // exercise // deque::assign(size_type, const_reference) - rw_info (0, 0, 0, "std::deque::assign(size_type, const_reference)"); + rw_info (0, 0, 0, + "std::deque::assign(size_type, const_reference)"); static const char seq[] = "abcdefghijklmnopqrstuvwxyz"; static const char res[] = "AAAAAAAAAAAAAAAAAAAAAAAAAA"; @@ -1000,7 +1013,8 @@ for (std::size_t i = 0; i != sizeof seq - 1; ++i) { for (std::size_t j = 0; j != sizeof seq - 1; ++j) { - test_assign (__LINE__, -1, (X*)0, int (j), seq, i, res, 1U, res, j); + test_assign (__LINE__, -1, (UserClass*)0, int (j), + seq, i, res, 1U, res, j); } } @@ -1011,39 +1025,41 @@ rw_info (0, 0, 0, "template " - "std::deque::assign(InputIterator, InputIterator)"); + "std::deque::assign(InputIterator, InputIterator)"); if (0 == rw_opt_no_input_iterator) - test_assign_range (InputIter(0, 0, 0), "InputIter"); + test_assign_range (InputIter(0, 0, 0), + "InputIter"); else rw_note (0, 0, __LINE__, "template " - "std::deque::assign(T, T) [with T = InputIterator]" + "std::deque::assign(T, T) [with T = InputIterator]" "test disabled."); if (0 == rw_opt_no_forward_iterator) - test_assign_range (FwdIter(), "FwdIter"); + test_assign_range (FwdIter(), "FwdIter"); else rw_note (0, 0, __LINE__, "template " - "std::deque::assign(T, T) [with T = ForwardIterator]" - "test disabled."); + "std::deque::assign(T, T) " + "[with T = ForwardIterator] test disabled."); if (0 == rw_opt_no_bidirectional_iterator) - test_assign_range (BidirIter(), "BidirIter"); + test_assign_range (BidirIter(), "BidirIter"); else rw_note (0, 0, __LINE__, "template " - "std::deque::assign(T, T) [with T = BidirectionalIterator]" - "test disabled."); + "std::deque::assign(T, T) " + "[with T = BidirectionalIterator] test disabled."); if (0 == rw_opt_no_random_iterator) - test_assign_range (RandomAccessIter(), "RandomAccessIter"); + test_assign_range (RandomAccessIter(), + "RandomAccessIter"); else rw_note (0, 0, __LINE__, "template " - "std::deque::assign(T, T) [with T = RandomAccessIterator]" - "test disabled."); + "std::deque::assign(T, T) " + "[with T = RandomAccessIterator] test disabled."); } /**************************************************************************/ @@ -1053,13 +1069,13 @@ std::size_t begoff, std::size_t len, const char *res, std::size_t reslen) { - const X* const xseq = X::from_char (seq, seqlen + 1); + const UserClass* const xseq = UserClass::from_char (seq, seqlen + 1); Deque deq = seqlen ? Deque (xseq, xseq + seqlen) : Deque (); const Deque::iterator start = deq.begin () + begoff; - int n_copy = X::n_total_copy_ctor_; - int n_asgn = X::n_total_op_assign_; + int n_copy = UserClass::n_total_copy_ctor_; + int n_asgn = UserClass::n_total_op_assign_; char* funcall = 0; std::size_t buflen = 0; @@ -1073,7 +1089,7 @@ begoff == deq.size (), begoff, begoff); exception_loop (line, Erase_1, funcall, 0, - deq, start, 1, 0, (X*)0, (X*)0, + deq, start, 1, 0, (UserClass*)0, (UserClass*)0, &n_copy, &n_asgn); } else { // assign(size_type, const_reference) @@ -1093,7 +1109,7 @@ end - deq.begin ()); exception_loop (line, EraseRange, funcall, 0, - deq, start, len, 0, (X*)0, (X*)0, + deq, start, len, 0, (UserClass*)0, (UserClass*)0, &n_copy, &n_asgn); } @@ -1151,12 +1167,12 @@ rw_assert (n_copy == int (expect_copy), 0, line, "line %d: %s: expected %zu invocations " - "of X::X(const X&), got %d\n", + "of UserClass::UserClass(const UserClass&), got %d\n", __LINE__, funcall, expect_copy, n_copy); rw_assert (n_asgn == int (expect_asgn), 0, line, "line %d: %s: expected %zu invocations " - "of X::operator=(const X&), got %d\n", + "of UserClass::operator=(const UserClass&), got %d\n", __LINE__, funcall, expect_asgn, n_asgn); #endif @@ -1170,7 +1186,7 @@ ////////////////////////////////////////////////////////////////// // exercise deque::erase(iterator) - rw_info (0, 0, 0, "std::deque::erase(iterator)"); + rw_info (0, 0, 0, "std::deque::erase(iterator)"); #undef TEST #define TEST(seq, off, res) do { \ @@ -1228,7 +1244,7 @@ ////////////////////////////////////////////////////////////////// // exercise deque::erase(iterator, iterator) - rw_info (0, 0, 0, "std::deque::erase(iterator, iterator)"); + rw_info (0, 0, 0, "std::deque::erase(iterator, iterator)"); } /**************************************************************************/ @@ -1274,14 +1290,14 @@ // * If the constructor // // template - // X (InputIterator f, InputIterator l, + // UserClass (InputIterator f, InputIterator l, // const allocator_type& a = allocator_type()) // // is called with a type InputIterator that does not qualify // as an input iterator, then the constructor will behave // as if the overloaded constructor: // - // X (size_type, const value_type& = value_type(), + // UserClass (size_type, const value_type& = value_type(), // const allocator_type& = allocator_type()) // // were called instead, with the arguments static_cast(f), @@ -1311,8 +1327,8 @@ // were called instead, with the same arguments. // // In the previous paragraph the alternative binding will fail - // if f is not implicitly convertible to X::size_type or - // if l is not implicitly convertible to X::value_type. + // if f is not implicitly convertible to UserClass::size_type or + // if l is not implicitly convertible to UserClass::value_type. // // The extent to which an implementation determines that a type // cannot be an input iterator is unspecified, except that @@ -1362,7 +1378,7 @@ new_capacity = caps [i]; rw_info (0, 0, 0, - "__rw::__rw_new_capacity >(0) = %zu", + "__rw::__rw_new_capacity >(0) = %zu", _RW::__rw_new_capacity (0, (Deque*)0)); if (0 == rw_opt_no_assign) Modified: incubator/stdcxx/trunk/tests/containers/23.deque.special.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/containers/23.deque.special.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/containers/23.deque.special.cpp (original) +++ incubator/stdcxx/trunk/tests/containers/23.deque.special.cpp Wed Feb 21 07:58:53 2007 @@ -6,16 +6,23 @@ * *************************************************************************** * - * Copyright (c) 1994-2005 Quovadx, Inc., acting through its Rogue Wave - * Software division. Licensed under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0. Unless required by - * applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - * CONDITIONS OF ANY KIND, either express or implied. See the License - * for the specific language governing permissions and limitations under - * the License. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 1994-2006 Rogue Wave Software. * **************************************************************************/ @@ -23,7 +30,7 @@ #include // for size_t -#include // for X +#include // for UserClass #include // for rw_test(), ... /**************************************************************************/ @@ -76,7 +83,7 @@ /**************************************************************************/ -typedef std::deque > Deque; +typedef std::deque > Deque; Deque::size_type new_capacity; @@ -231,7 +238,7 @@ void test_swap () { test_swap ((int*)0, "int"); - test_swap ((X*)0, "X"); + test_swap ((UserClass*)0, "UserClass"); } /**************************************************************************/ @@ -250,7 +257,7 @@ new_capacity = caps [i]; rw_info (0, 0, 0, - "__rw::__rw_new_capacity >(0) = %u", + "__rw::__rw_new_capacity >(0) = %u", _RW::__rw_new_capacity (0, (Deque*)0)); test_swap (); Modified: incubator/stdcxx/trunk/tests/containers/23.vector.capacity.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/containers/23.vector.capacity.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/containers/23.vector.capacity.cpp (original) +++ incubator/stdcxx/trunk/tests/containers/23.vector.capacity.cpp Wed Feb 21 07:58:53 2007 @@ -6,22 +6,23 @@ * *************************************************************************** * - * Copyright 2006 The Apache Software Foundation or its licensors, - * as applicable. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at * - * Copyright 2006 Rogue Wave Software. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 2006 Rogue Wave Software. * **************************************************************************/ @@ -29,6 +30,7 @@ #include // for vector #include +#include // for UserClass #include /**************************************************************************/ @@ -38,7 +40,7 @@ /**************************************************************************/ -typedef std::vector > Vector; +typedef std::vector > Vector; // exercise vector<>::capacity() and vector<>::reserve() // focus on the complexity of the function @@ -51,21 +53,21 @@ const Vector::size_type size = v.size (); Vector::const_pointer begin = size ? &v [0] : 0; - X::reset_totals (); + UserClass::reset_totals (); // call reserve capacity that is less than or equal to the current value v.reserve (cap / 2); // verify that the call had no effect rw_assert (v.capacity () == cap, 0, __LINE__, - "vector(%zu).reserve(%zu); capacity() == %zu, got %zu", - nelems, cap / 2, cap, v.capacity ()); + "vector(%zu).reserve(%zu); capacity() == %zu, " + "got %zu", nelems, cap / 2, cap, v.capacity ()); if (size) { // verify that no reallocation took place rw_assert (begin == &v [0], 0, __LINE__, - "vector(%zu).reserve(%zu) unexpectedly reallocated", - nelems, cap / 2); + "vector(%zu).reserve(%zu) unexpectedly " + "reallocated", nelems, cap / 2); } // call reserve the same capacity as the current value @@ -73,14 +75,14 @@ // verify that the call had no effect rw_assert (v.capacity () == cap, 0, __LINE__, - "vector(%zu).reserve(%zu); capacity() == %zu, got %zu", - nelems, cap / 2, cap, v.capacity ()); + "vector(%zu).reserve(%zu); capacity() == %zu, " + "got %zu", nelems, cap / 2, cap, v.capacity ()); if (size) { // verify that no reallocation took place rw_assert (begin == &v [0], 0, __LINE__, - "vector(%zu).reserve(%zu) unexpectedly reallocated", - nelems, cap / 2); + "vector(%zu).reserve(%zu) unexpectedly " + "reallocated", nelems, cap / 2); } // call reserve with a larger capacity then is available @@ -89,19 +91,19 @@ // 23.2.4.2, p2: After reserve (), capacity () is greater or equal // to the reserve value if reallocation happens rw_assert (v.capacity () >= cap + 1, 0, __LINE__, - "vector(%zu).reserve(%zu); capacity() > %zu, got %zu", + "vector(%zu).reserve(%zu); capacity() > %zu, got %zu", nelems, cap + 1, cap, v.capacity ()); // 23.2.3.2, p3: reserve shall not change the size of the sequence rw_assert (v.size () == size, 0, __LINE__, - "vector(%zu).reserve(); size() == %zu, got %zu", + "vector(%zu).reserve(); size() == %zu, got %zu", nelems, size, v.size ()); // 23.2.3.2, p3: takes at most linear time in the size of the sequence - rw_assert (X::n_total_copy_ctor_ == v.size (), 0, __LINE__, - "vector(%zu).reserve(%zu) complexity: " + rw_assert (UserClass::n_total_copy_ctor_ == v.size (), 0, __LINE__, + "vector(%zu).reserve(%zu) complexity: " "copy ctor called %zu times when size() = %zu", - nelems, cap + 1, X::n_total_copy_ctor_, v.size ()); + nelems, cap + 1, UserClass::n_total_copy_ctor_, v.size ()); if (size) { begin = &v [0]; @@ -109,11 +111,11 @@ // verify 23.2.4.2, p5: no reallocation takes place until // the size of the container would exceed its capacity for (Vector::size_type i = 0; i != v.capacity () - size; ++i) { - v.push_back (X ()); + v.push_back (UserClass ()); rw_assert (begin == &v [0], 0, __LINE__, - "vector(%zu).reserve(%zu); insertion of element " - "%zu unexpectedly reallocated; size() = %zu", + "vector(%zu).reserve(%zu); insertion of " + "element %zu unexpectedly reallocated; size() = %zu", nelems, cap + 1, v.size ()); } } @@ -142,12 +144,14 @@ } rw_assert (0 != caught, 0, __LINE__, - "vector(%zu).reserve(%zu) expected exception not thrown", + "vector(%zu).reserve(%zu) " + "expected exception not thrown", nelems, too_much); if (caught) rw_assert ('\0' == *caught, 0, __LINE__, - "vector(%zu).reserve(%zu) expected length_error, got %s", + "vector(%zu).reserve(%zu) " + "expected length_error, got %s", nelems, too_much, caught); #endif // _RWSTD_NO_EXCEPTIONS @@ -159,8 +163,8 @@ static int run_test (int /* argc */, char** /* argv */) { - rw_info (0, 0, 0, "std::vector::capacity() const"); - rw_info (0, 0, 0, "std::vector::reserve(size_type)"); + rw_info (0, 0, 0, "std::vector::capacity() const"); + rw_info (0, 0, 0, "std::vector::reserve(size_type)"); const Vector::size_type max_elems = Vector::size_type (rw_opt_nloops); Modified: incubator/stdcxx/trunk/tests/containers/23.vector.cons.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/containers/23.vector.cons.cpp?view=diff&rev=510071&r1=510070&r2=510071 ============================================================================== --- incubator/stdcxx/trunk/tests/containers/23.vector.cons.cpp (original) +++ incubator/stdcxx/trunk/tests/containers/23.vector.cons.cpp Wed Feb 21 07:58:53 2007 @@ -6,22 +6,23 @@ * *************************************************************************** * - * Copyright 2006 The Apache Software Foundation or its licensors, - * as applicable. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at * - * Copyright 2006 Rogue Wave Software. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + * + * Copyright 2006 Rogue Wave Software. * **************************************************************************/ @@ -31,6 +32,7 @@ #include // for size_t #include +#include // for UserClass #include #include @@ -296,33 +298,33 @@ // focus on the correct construction and destruction of values void test_ctors () { - typedef std::vector > Vector; + typedef std::vector > Vector; if (1) { rw_info (0, 0, 0, - "std::vector::vector(size_type, " + "std::vector::vector(size_type, " "const_reference, const allocator_type&)"); - rw_info (0, 0, 0, "std::vector::vector(const vector&)"); + rw_info (0, 0, 0, "std::vector::vector(const vector&)"); // reset function call counters - X::reset_totals (); + UserClass::reset_totals (); - // total number of objects of type X in existence - const std::size_t x_count = X::count_; + // total number of objects of type UserClass in existence + const std::size_t x_count = UserClass::count_; for (Vector::size_type i = 0; i != rw_opt_nloops; ++i) { - rw_assert (X::count_ == x_count, 0, __LINE__, - "vector::vector(size_type, const_reference); " + rw_assert (UserClass::count_ == x_count, 0, __LINE__, + "vector::vector(size_type, const_reference); " "leaked %zu objects of value_type", - X::count_ - x_count); + UserClass::count_ - x_count); // reset function call counters - X::reset_totals (); + UserClass::reset_totals (); - const X val; + const UserClass val; // initialize a vector with `i' copies of `val' const Vector v0 (i, val); @@ -330,17 +332,17 @@ && v0.begin () + i == v0.end () && v0.rbegin () + i == v0.rend (), 0, __LINE__, - "vector::vector(size_type, const_reference)"); + "vector::vector(size_type, const_reference)"); // verify that the vector ctor calls only copy ctor - // of X and anly the given number of times each - rw_assert (X::is_total (i + 1, 1, i, 0, 0, 0), 0, __LINE__, - "vector::vector(size_type, const_reference); " + // of UserClass and anly the given number of times each + rw_assert (UserClass::is_total (i + 1, 1, i, 0, 0, 0), 0, __LINE__, + "vector::vector(size_type, const_reference); " "called default/copy ctor and operator=() %zu, %zu, " "and %zu times, respectively, 0, %zu, 0 expected", - X::n_total_def_ctor_ - 1, - X::n_total_copy_ctor_, - X::n_total_op_assign_, i); + UserClass::n_total_def_ctor_ - 1, + UserClass::n_total_copy_ctor_, + UserClass::n_total_op_assign_, i); // create a copy Vector v1 (v0); @@ -348,18 +350,18 @@ && v1.begin () + i == v1.end () && v1.rbegin () + i == v1.rend (), 0, __LINE__, - "vector::vector(const vector&)"); + "vector::vector(const vector&)"); // verify that the vector copy ctor calls only copy ctor - // of X and anly the given number of times each - rw_assert (X::is_total (2 * i + 1, 1, 2 * i, 0, 0, 0), + // of UserClass and anly the given number of times each + rw_assert (UserClass::is_total (2 * i + 1, 1, 2 * i, 0, 0, 0), 0, __LINE__, - "vector::vector(size_type, const_reference); " + "vector::vector(size_type, const_reference); " "called default/copy ctor and operator=() %zu, %zu, " "and %zu times, respectively, 0, %zu, 0 expected", - X::n_total_def_ctor_ - 1, - X::n_total_copy_ctor_, - X::n_total_op_assign_, i); + UserClass::n_total_def_ctor_ - 1, + UserClass::n_total_copy_ctor_, + UserClass::n_total_op_assign_, i); // exercise vector<>operator=(const vector&) Vector v2 (i, val); @@ -371,10 +373,12 @@ // assign a vector (of a possibly unequal size) v3 = v2; rw_assert (v3.size () == v2.size (), 0, __LINE__, - "%zu. vector::operator=(const vector&)", j); + "%zu. vector::operator=(const vector&)", + j); rw_assert (v3 == v2, 0, __LINE__, - "%zu. vector::operator=(const vector&)", j); + "%zu. vector::operator=(const vector&)", + j); } #ifndef _RWSTD_NO_EXCEPTIONS @@ -390,12 +394,13 @@ char buf [sizeof (Vector)]; } buf = { 0 }; - std::size_t x_count_save = X::count_; + std::size_t x_count_save = UserClass::count_; try { - // have X copy ctor throw an exception during + // have UserClass copy ctor throw an exception during // the copying of the last value - X::copy_ctor_throw_count_ = X::n_total_copy_ctor_ + i; + UserClass::copy_ctor_throw_count_ = + UserClass::n_total_copy_ctor_ + i; // create a vector object, throw an exception // expect vector ctor to destroy any values @@ -427,19 +432,20 @@ rw_assert (i == 0 || thrown, 0, __LINE__, "logic error: failed to throw"); - rw_assert (x_count_save == X::count_, 0, __LINE__, - "vector::vector(size_type, const_reference) " + rw_assert (x_count_save == UserClass::count_, 0, __LINE__, + "vector::vector(size_type, const_reference) " "leaked %zu value(s) of %zu after an exception", - X::count_ - x_count_save, i); + UserClass::count_ - x_count_save, i); // exercise vector<>::vector(const vector&) thrown = false; - x_count_save = X::count_; + x_count_save = UserClass::count_; try { - // have X copy ctor throw an exception during + // have UserClass copy ctor throw an exception during // the copying of the last value - X::copy_ctor_throw_count_ = X::n_total_copy_ctor_ + i; + UserClass::copy_ctor_throw_count_ = + UserClass::n_total_copy_ctor_ + i; // use placement new to prevent vector destruction // at scope exit (the object should be destroyed @@ -467,14 +473,14 @@ rw_assert(i == 0 || thrown, 0, __LINE__, "logic error: failed to throw"); - rw_assert (x_count_save == X::count_, 0, __LINE__, - "vector::vector(const vector&) leaked " + rw_assert (x_count_save == UserClass::count_, 0, __LINE__, + "vector::vector(const vector&) leaked " "%zu value(s) of %zu after an exception", - X::count_ - x_count_save, i); + UserClass::count_ - x_count_save, i); // disable exceptions - X::copy_ctor_throw_count_ = std::size_t (-1); + UserClass::copy_ctor_throw_count_ = std::size_t (-1); // remember v1's size and capacity const Vector::size_type v1_size = v1.size (); @@ -488,12 +494,13 @@ // exrecise vector<>::operator=(const vector&) thrown = false; - x_count_save = X::count_; + x_count_save = UserClass::count_; try { - // have X copy ctor throw an exception during + // have UserClass copy ctor throw an exception during // the copying of the last value - X::copy_ctor_throw_count_ = X::n_total_copy_ctor_ + v3.size (); + UserClass::copy_ctor_throw_count_ = + UserClass::n_total_copy_ctor_ + v3.size (); // assign over the existing elements, the last copy ctor or // operator=() throws, destroying all values assigned so far @@ -505,22 +512,23 @@ } // disable exceptions - X::copy_ctor_throw_count_ = std::size_t (-1); + UserClass::copy_ctor_throw_count_ = std::size_t (-1); rw_assert (i == 0 || thrown, 0, __LINE__, "logic error: failed to throw"); // verify that no values leaked - rw_assert (x_count_save == X::count_, 0, __LINE__, - "vector::vector(const vector&) leaked " + rw_assert (x_count_save == UserClass::count_, 0, __LINE__, + "vector::vector(const vector&) leaked " "%zu value(s) of %zu after an exception", - X::count_ - x_count_save, i); + UserClass::count_ - x_count_save, i); // verify that the size of the left hand size operand // of the assignment hasn't changed rw_assert (v1.size () == v1_size && v1.capacity () == v1_cap, - 0, __LINE__, "vector::operator=(const vector&) " - "changed size of *this from %zu to %zu after exception", + 0, __LINE__, "vector::operator=" + "(const vector&) changed size of *this from " + "%zu to %zu after exception", i / 2, v3.size ()); #endif // _RWSTD_NO_EXCEPTIONS @@ -536,7 +544,8 @@ { if (1) { - rw_info (0, 0, 0, "std::vector::vector(const allocator_type&)"); + rw_info (0, 0, 0, + "std::vector::vector(const allocator_type&)"); // verify default ctor arguments Vector v0; @@ -545,18 +554,18 @@ rw_assert ( 0 == v0.size () && v0.empty () && v0.begin () == v0.end () && v0.rbegin () == v0.rend (), 0, __LINE__, - ("vector::vector()")); + ("vector::vector()")); rw_assert ( 0 == v1.size () && v1.empty () && v1.begin () == v1.end () && v1.rbegin () == v1.rend (), 0, __LINE__, - "vector::vector()"); + "vector::vector()"); } if (1) { rw_info (0, 0, 0, - "std::vector::vector(size_type, " + "std::vector::vector(size_type, " "const_reference, const allocator_type&)"); for (typename Vector::size_type i = 0; i != rw_opt_nloops; ++i) { @@ -570,14 +579,15 @@ && v0.begin () + i == v0.end () && v0.rbegin () + i == v0.rend (), 0, __LINE__, - "vector::vector(size_type, const_reference)"); + "vector::vector" + "(size_type, const_reference)"); rw_assert ( i == v1.size () && v1.begin () + i == v1.end () && v1.rbegin () + i == v1.rend (), 0, __LINE__, - "vector::vector(size_type, const_reference, " - "const allocator_type&)"); + "vector::vector(size_type, " + "const_reference, const allocator_type&)"); bool success = true; for (typename Vector::size_type j = 0; j != i; ++j) { @@ -588,7 +598,7 @@ } rw_assert (success, 0, __LINE__, - "vector::vector(size_type, const_reference); " + "vector::vector(size_type, const_reference); " "all elements initialized"); } } @@ -599,7 +609,7 @@ if (1) { rw_info (0, 0, 0, - "template std::vector::vector " + "template std::vector::vector" "(InputIterator, InputIterator)"); bool success = true; @@ -649,7 +659,8 @@ rw_assert (success, 0, __LINE__, "template " - "std::vector::vector(InputIterator, InputIterator)"); + "std::vector::vector" + "(InputIterator, InputIterator)"); // destroy and deallocate... for (typename Vector::size_type j = 0; j != rw_opt_nloops; ++j)