From 1b5d159612be5df504d5a2841fea78155a640fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Mon, 16 Mar 2015 19:23:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Test/COWPtrTest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TinySTL/Test/COWPtrTest.cpp b/TinySTL/Test/COWPtrTest.cpp index 08667aa..4b711de 100644 --- a/TinySTL/Test/COWPtrTest.cpp +++ b/TinySTL/Test/COWPtrTest.cpp @@ -17,11 +17,11 @@ namespace TinySTL{ assert(*cp3 == "hello"); assert(cp1.get() == cp2.get() && cp2.get() == cp3.get()); - assert(cp1 == cp2 && !(cp2 != cp3)); - *cp1 = "zouxiaohang"; - assert(*cp1 == "zouxiaohang"); + string zxh(" zouxiaohang"); + cp1->append(zxh); + assert(*cp1 == "hello zouxiaohang"); assert(*cp2 == "hello" && *cp3 == "hello"); cow_ptr cp4; @@ -37,9 +37,9 @@ namespace TinySTL{ assert(cp1 == cp2 && cp2 == cp3); assert(*cp1 == *cp2 && *cp2 == *cp3 && *cp3 == "zouxiaohang"); - cp2->append(" C++");//write + *cp2 = ("C++");//write assert(*cp1 == *cp3 && *cp3 == "zouxiaohang"); - assert(*cp2 == "zouxiaohang C++"); + assert(*cp2 == "C++"); } void testAllCases(){ -- GitLab