diff options
author | mtklein <mtklein@chromium.org> | 2016-01-24 19:18:54 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-24 19:18:54 -0800 |
commit | ccf1de0d9aa75f29829f1c4c462214b991fd8c9e (patch) | |
tree | 20460f16ab9a5efaee8374406e9dc680f155d13f /tests | |
parent | 3b69b82b22ba854f9a8e9f1ccb54f0d9022c0bd8 (diff) |
skstd -> std for unique_ptr
TBR=reed@google.com
No public API changes.
BUG=skia:4564
Committed: https://skia.googlesource.com/skia/+/755c553c17b82bb5de3d9cc8d3b2a866ff9e9e50
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Mac10.9-Clang-x86_64-Release-CMake-Trybot,Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link-Trybot;client.skia:Perf-Mac10.9-Clang-MacMini6.2-CPU-AVX-x86_64-Release-Trybot,Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release-Trybot
Committed: https://skia.googlesource.com/skia/+/06189155d987db5c7e69015f6ea87c2168d6a065
Committed: https://skia.googlesource.com/skia/+/70e8dfca4a7f5bce97b8021a6e378c4828b09c8c
Committed: https://skia.googlesource.com/skia/+/dadfc245cc9a0279ff7b73da3344f2ca5d139907
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1436033003
Review URL: https://codereview.chromium.org/1436033003
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CPlusPlusEleven.cpp | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/tests/CPlusPlusEleven.cpp b/tests/CPlusPlusEleven.cpp deleted file mode 100644 index 0cd2e937b2..0000000000 --- a/tests/CPlusPlusEleven.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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" -#include "SkTemplates.h" -#include <utility> - -namespace { -class Moveable { -public: - Moveable() {} - Moveable(Moveable&&) {} - Moveable& operator=(Moveable&&) { return *this; } -private: - Moveable(const Moveable&); - Moveable& operator=(const Moveable&); -}; -template <typename T> void deleter(T*) { } -template <typename T> struct Deleter { - void operator()(T* t) { delete static_cast<const Moveable*>(t); } -}; -} // namespace - -DEF_TEST(CPlusPlusEleven_RvalueAndMove, r) { - Moveable src1; Moveable dst1(std::move(src1)); - Moveable src2, dst2; dst2 = std::move(src2); -} - -#define TOO_BIG "The unique_ptr was bigger than expected." -#define WEIRD_SIZE "The unique_ptr was a different size than expected." - -DEF_TEST(CPlusPlusEleven_UniquePtr, r) { - struct SmallUniquePtr { - Moveable* p; - }; - struct BigUniquePtr { - void(*d)(Moveable*); - Moveable* p; - }; - - static_assert(sizeof(skstd::unique_ptr<Moveable>) == sizeof(SmallUniquePtr), TOO_BIG); - static_assert(sizeof(skstd::unique_ptr<Moveable[]>) == sizeof(SmallUniquePtr), TOO_BIG); - - using proc = void(*)(Moveable*); - static_assert(sizeof(skstd::unique_ptr<Moveable, proc>) == sizeof(BigUniquePtr), WEIRD_SIZE); - static_assert(sizeof(skstd::unique_ptr<Moveable[], proc>) == sizeof(BigUniquePtr), WEIRD_SIZE); - - { - skstd::unique_ptr<Moveable, void(*)(Moveable*)> u(nullptr, deleter<Moveable>); - static_assert(sizeof(u) == sizeof(BigUniquePtr), WEIRD_SIZE); - - auto u2 = std::move(u); - static_assert(sizeof(u2) == sizeof(BigUniquePtr), WEIRD_SIZE); - } - - { - skstd::unique_ptr<Moveable, void(*)(Moveable*)> u(nullptr, [](Moveable* m){ deleter(m); }); - static_assert(sizeof(u) == sizeof(BigUniquePtr), WEIRD_SIZE); - - auto u2 = std::move(u); - static_assert(sizeof(u2) == sizeof(BigUniquePtr), WEIRD_SIZE); - } - - { - auto d = [](Moveable* m){ deleter(m); }; - skstd::unique_ptr<Moveable, decltype(d)> u(nullptr, d); - static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); - - auto u2 = std::move(u); - static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); - } - - { - skstd::unique_ptr<Moveable, Deleter<Moveable>> u(nullptr, Deleter<Moveable>()); - static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); - - auto u2 = std::move(u); - static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); - } - - { - skstd::unique_ptr<Moveable, Deleter<Moveable>> u(new Moveable(), Deleter<Moveable>()); - static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); - - auto u2 = std::move(u); - static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); - } - - { - skstd::unique_ptr<const void, Deleter<const void>> u(new Moveable(), Deleter<const void>()); - static_assert(sizeof(u) == sizeof(SmallUniquePtr), TOO_BIG); - - auto u2 = std::move(u); - static_assert(sizeof(u2) == sizeof(SmallUniquePtr), TOO_BIG); - } -} |