| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "Test.h" | 7 #include "Test.h" |
| 8 #include "SkTemplates.h" | 8 #include "SkTemplates.h" |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 Moveable src1; Moveable dst1(std::move(src1)); | 28 Moveable src1; Moveable dst1(std::move(src1)); |
| 29 Moveable src2, dst2; dst2 = std::move(src2); | 29 Moveable src2, dst2; dst2 = std::move(src2); |
| 30 } | 30 } |
| 31 | 31 |
| 32 DEF_TEST(CPlusPlusEleven_constexpr, r) { | 32 DEF_TEST(CPlusPlusEleven_constexpr, r) { |
| 33 static constexpr int x = Sk32ToBool(50); | 33 static constexpr int x = Sk32ToBool(50); |
| 34 REPORTER_ASSERT(r, x == 1); | 34 REPORTER_ASSERT(r, x == 1); |
| 35 static constexpr int y = SkTPin<int>(100, 0, 10); | 35 static constexpr int y = SkTPin<int>(100, 0, 10); |
| 36 REPORTER_ASSERT(r, y == 10); | 36 REPORTER_ASSERT(r, y == 10); |
| 37 } | 37 } |
| 38 |
| 39 namespace { |
| 40 struct MoveableCopyable { |
| 41 bool fCopied; |
| 42 MoveableCopyable() : fCopied(false) {} |
| 43 MoveableCopyable(const MoveableCopyable &o) : fCopied(true) {} |
| 44 MoveableCopyable(MoveableCopyable &&o) : fCopied(o.fCopied) {} |
| 45 }; |
| 46 struct TestClass { |
| 47 MoveableCopyable fFoo; |
| 48 }; |
| 49 } // namespace |
| 50 |
| 51 DEF_TEST(CPlusPlusEleven_default_move, r) { |
| 52 TestClass a; |
| 53 TestClass b(a); |
| 54 TestClass c(std::move(a)); |
| 55 REPORTER_ASSERT(r, b.fFoo.fCopied); |
| 56 REPORTER_ASSERT(r, !c.fFoo.fCopied); |
| 57 } |
| OLD | NEW |