components/stdcxx/patches/072-21.string.replace.stdcxx-170.cpp.patch
changeset 402 94ae4d75524c
equal deleted inserted replaced
401:bf52ef48020c 402:94ae4d75524c
       
     1 --- stdcxx-4.2.1/tests/strings/21.string.replace.stdcxx-170.cpp	2011-01-06 23:30:16.580682374 -0500
       
     2 +++ stdcxx-4.2.1/tests/strings/21.string.replace.stdcxx-170.cpp	2011-01-26 01:31:44.599748916 -0500
       
     3 @@ -0,0 +1,54 @@
       
     4 +/************************************************************************
       
     5 +*
       
     6 +* 21.string.replace.stdcxx-170.cpp - regression test for STDCXX-170
       
     7 +*
       
     8 +* https://issues.apache.org/jira/browse/STDCXX-170
       
     9 +*
       
    10 +* $Id:  $
       
    11 +*
       
    12 +***************************************************************************
       
    13 +*
       
    14 +* Licensed to the Apache Software  Foundation (ASF) under one or more
       
    15 +* contributor  license agreements.  See  the NOTICE  file distributed
       
    16 +* with  this  work  for  additional information  regarding  copyright
       
    17 +* ownership.   The ASF  licenses this  file to  you under  the Apache
       
    18 +* License, Version  2.0 (the  "License"); you may  not use  this file
       
    19 +* except in  compliance with the License.   You may obtain  a copy of
       
    20 +* the License at
       
    21 +*
       
    22 +* http://www.apache.org/licenses/LICENSE-2.0
       
    23 +*
       
    24 +* Unless required by applicable law or agreed to in writing, software
       
    25 +* distributed under the  License is distributed on an  "AS IS" BASIS,
       
    26 +* WITHOUT  WARRANTIES OR CONDITIONS  OF ANY  KIND, either  express or
       
    27 +* implied.   See  the License  for  the  specific language  governing
       
    28 +* permissions and limitations under the License.
       
    29 +*
       
    30 +**************************************************************************/
       
    31 +
       
    32 +#include <cassert>
       
    33 +#include <string>
       
    34 +#include <iostream>
       
    35 +
       
    36 +int main ()
       
    37 +{
       
    38 +    std::string s ("abc");
       
    39 +
       
    40 +    s.replace (s.begin (), s.begin (), s.rbegin () + 1, s.rbegin () + 2);
       
    41 +
       
    42 +    assert ("babc" == s);
       
    43 +
       
    44 +	std::cout << "1. Expected 'babc', got '" << s.c_str() << "'." << std::endl;
       
    45 +
       
    46 +    s = "abc";
       
    47 +
       
    48 +    typedef const unsigned char UChar;
       
    49 +    s.replace (s.begin (), s.begin (), (UChar*)&s [1], (UChar*)&s [2]);
       
    50 +
       
    51 +    assert ("babc" == s);
       
    52 +
       
    53 +	std::cout << "2. Expected 'babc', got '" << s.c_str() << "'." << std::endl;
       
    54 +
       
    55 +    return 0;
       
    56 +}
       
    57 +