From: halcanary Date: Fri, 13 Feb 2015 23:12:52 +0000 (-0800) Subject: C++11 Unit Test for RValue semantics. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~3579 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3a6672ae0c95f24f873dca21424e060df9f9c3e5;p=platform%2Fupstream%2FlibSkiaSharp.git C++11 Unit Test for RValue semantics. Motivation: test that these works on all possible bots and for all possible clients (clients do run these unit tests, right?) Dear clients: if this unit test fails, let us know! BUG=skia:3427 Review URL: https://codereview.chromium.org/922043004 --- diff --git a/gyp/tests.gypi b/gyp/tests.gypi index 625fa86..ace8971 100644 --- a/gyp/tests.gypi +++ b/gyp/tests.gypi @@ -74,6 +74,7 @@ '../tests/ColorFilterTest.cpp', '../tests/ColorPrivTest.cpp', '../tests/ColorTest.cpp', + '../tests/CPlusPlusEleven.cpp', '../tests/DashPathEffectTest.cpp', '../tests/DataRefTest.cpp', '../tests/DeferredCanvasTest.cpp', diff --git a/tests/CPlusPlusEleven.cpp b/tests/CPlusPlusEleven.cpp new file mode 100644 index 0000000..4182112 --- /dev/null +++ b/tests/CPlusPlusEleven.cpp @@ -0,0 +1,26 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#include "Test.h" + +namespace { +template T&& Move(T& o) { return static_cast(o); } + +class Moveable { +public: + Moveable() {} + Moveable(Moveable&&) {} + Moveable& operator=(Moveable&&) { return *this; } +private: + Moveable(const Moveable&); + Moveable& operator=(const Moveable&); +}; +} // namespace + +DEF_TEST(CPlusPlusEleven_RvalueAndMove, r) { + Moveable src1; Moveable dst1(Move(src1)); + Moveable src2, dst2; dst2 = Move(src2); +}