From stdcxx-commits-return-494-apmail-incubator-stdcxx-commits-archive=incubator.apache.org@incubator.apache.org Tue Feb 28 02:35:28 2006 Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 14233 invoked from network); 28 Feb 2006 02:35:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 28 Feb 2006 02:35:28 -0000 Received: (qmail 52667 invoked by uid 500); 28 Feb 2006 02:35:28 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 52645 invoked by uid 500); 28 Feb 2006 02:35:28 -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 52633 invoked by uid 500); 28 Feb 2006 02:35:28 -0000 Delivered-To: apmail-incubator-stdcxx-cvs@incubator.apache.org Received: (qmail 52630 invoked by uid 99); 28 Feb 2006 02:35:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Feb 2006 18:35:28 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 27 Feb 2006 18:35:27 -0800 Received: (qmail 14057 invoked by uid 65534); 28 Feb 2006 02:35:07 -0000 Message-ID: <20060228023507.14056.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r381545 - /incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp Date: Tue, 28 Feb 2006 02:35:06 -0000 To: stdcxx-cvs@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: sebor Date: Mon Feb 27 18:35:05 2006 New Revision: 381545 URL: http://svn.apache.org/viewcvs?rev=381545&view=rev Log: 2006-02-27 Martin Sebor * 25.unique.cpp (run_test): Used BinaryPredicate::op_equals. (test_unique): Removed case sensitive tests. (test_unique): Used X::mismatch() instead of comparing the resulting sequence manually one element at a time, and used %{X=*.@} instead of %{X=*.*} for simplicity. Modified: incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp Modified: incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp?rev=381545&r1=381544&r2=381545&view=diff ============================================================================== --- incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp (original) +++ incubator/stdcxx/trunk/tests/algorithms/25.unique.cpp Mon Feb 27 18:35:05 2006 @@ -1,21 +1,27 @@ /*************************************************************************** * - * 25.unique.cpp - test exercising 25.2.8 [lib.alg.unique] + * unique.cpp - test exercising 25.2.8 [lib.alg.unique] * * $Id$ * *************************************************************************** * - * 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. + * Copyright 2006 The Apache Software Foundation or its licensors, + * as applicable. + * + * 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 + * + * 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. * **************************************************************************/ @@ -106,18 +112,16 @@ std::size_t n_total_ops = ppred ? Predicate::n_total_op_fcall_ : T::n_total_op_eq_; - const Predicate pred (true); - OutIterator res_c (0, 0, 0); FwdIterator res (0, 0, 0); if (use_copy) res_c = ppred ? - std::unique_copy (first_c, last_c, result, pred) + std::unique_copy (first_c, last_c, result, *ppred) : std::unique_copy (first_c, last_c, result); else res = ppred ? - std::unique (first, last, pred) + std::unique (first, last, *ppred) : std::unique (first, last); const T* const f_cur = use_copy ? result.cur_ : first.cur_; @@ -131,24 +135,16 @@ funname, src, ndst, r_cur - f_cur); // verify that the copied sequence matches the expected range - std::size_t i = 0; - for ( ; i != ndst; ++i) { - - typedef unsigned char UChar; + const T* const mismatch = T::mismatch (xdst, dst, ndst); - success = UChar (dst [i]) == xdst [i].val_; - if (!success) - break; - } - - rw_assert (success, 0, line, + rw_assert (0 == mismatch, 0, line, "line %d: std::%s <%s%{?}, %s%{;}%{?}, %s%{;}>(\"%s\", ...) " - "==> \"%s\", got \"%{X=*.*}\"", + "==> \"%s\", got \"%{X=*.@}\"", __LINE__, fname, itname, use_copy, outname, 0 != ppred, - funname, src, dst, int (ndst), int (i), xdst); + funname, src, dst, int (ndst), mismatch, xdst); if (ppred) - n_total_ops = Predicate::n_total_op_fcall_ - n_total_ops; + n_total_ops = ppred->n_total_op_fcall_ - n_total_ops; else n_total_ops = T::n_total_op_eq_ - n_total_ops; @@ -227,29 +223,6 @@ TEST ("abbbbbaaabb", "abab"); TEST ("abaaaaaaabb", "abab"); TEST ("ababbbbbbbb", "abab"); - - // different data for each version of the template - // (with and without the predicate argument) - -#undef TEST -#define TEST(src, dst, dst_nocase) \ - test_unique (__LINE__, src, ppred ? dst_nocase : dst, \ - it, itc, out, (T*)0, ppred, use_copy) - - TEST ("aA", "aA", "a"); - TEST ("Aa", "Aa", "A"); - TEST ("aAA", "aA", "a"); - TEST ("AaA", "AaA", "A"); - TEST ("AaAa", "AaAa", "A"); - TEST ("AAaa", "Aa", "A"); - TEST ("AAaaA", "AaA", "A"); - TEST ("AAaaB", "AaB", "AB"); - TEST ("AAaaBb", "AaBb", "AB"); - TEST ("AAaaBB", "AaB", "AB"); - TEST ("AAaaBBb", "AaBb", "AB"); - TEST ("AAaabBb", "AabBb", "Ab"); - TEST ("aaAABBb", "aABb", "aB"); - TEST ("aaAAbBb", "aAbBb", "ab"); } /**************************************************************************/ @@ -372,7 +345,7 @@ static int run_test (int, char*[]) { - const BinaryPredicate pred(true); + const BinaryPredicate pred (BinaryPredicate::op_equals); if (rw_opt_no_unique) { rw_note (0, __FILE__, __LINE__, "std::unique test disabled");