components/stdcxx/patches/072-21.string.replace.stdcxx-170.cpp.patch
author Rich Burridge <rich.burridge@oracle.com>
Fri, 06 Feb 2015 12:30:31 -0800
changeset 3744 a74b6fa1af7a
parent 402 94ae4d75524c
permissions -rw-r--r--
20455804 TWISTED should have some master test results to compare against 20471207 doc/testing.txt should advise removing build output from the master results

--- stdcxx-4.2.1/tests/strings/21.string.replace.stdcxx-170.cpp	2011-01-06 23:30:16.580682374 -0500
+++ stdcxx-4.2.1/tests/strings/21.string.replace.stdcxx-170.cpp	2011-01-26 01:31:44.599748916 -0500
@@ -0,0 +1,54 @@
+/************************************************************************
+*
+* 21.string.replace.stdcxx-170.cpp - regression test for STDCXX-170
+*
+* https://issues.apache.org/jira/browse/STDCXX-170
+*
+* $Id:  $
+*
+***************************************************************************
+*
+* 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.
+*
+**************************************************************************/
+
+#include <cassert>
+#include <string>
+#include <iostream>
+
+int main ()
+{
+    std::string s ("abc");
+
+    s.replace (s.begin (), s.begin (), s.rbegin () + 1, s.rbegin () + 2);
+
+    assert ("babc" == s);
+
+	std::cout << "1. Expected 'babc', got '" << s.c_str() << "'." << std::endl;
+
+    s = "abc";
+
+    typedef const unsigned char UChar;
+    s.replace (s.begin (), s.begin (), (UChar*)&s [1], (UChar*)&s [2]);
+
+    assert ("babc" == s);
+
+	std::cout << "2. Expected 'babc', got '" << s.c_str() << "'." << std::endl;
+
+    return 0;
+}
+