X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Ftest%2FMoveWrapperTest.cpp;h=4b4c933264bdf6ff426a59eeb52083cde1d179cc;hb=db13010c1338d471c713a652e0940afba627b8bc;hp=6d660bea6000faaad3ea1cabf0645d769af5ef04;hpb=275ca94d04e44f28cfa411668eb1c1dd8db90b80;p=folly.git diff --git a/folly/test/MoveWrapperTest.cpp b/folly/test/MoveWrapperTest.cpp index 6d660bea..4b4c9332 100644 --- a/folly/test/MoveWrapperTest.cpp +++ b/folly/test/MoveWrapperTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2015 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,12 @@ * limitations under the License. */ -#include - #include + #include +#include + namespace folly { TEST(makeMoveWrapper, Empty) { @@ -27,11 +28,26 @@ TEST(makeMoveWrapper, Empty) { } TEST(makeMoveWrapper, NonEmpty) { - auto u = std::unique_ptr(new int(5)); + auto u = std::make_unique(5); EXPECT_EQ(*u, 5); auto p = makeMoveWrapper(std::move(u)); EXPECT_TRUE(!u); EXPECT_EQ(**p, 5); } -} // namespace +TEST(makeMoveWrapper, rvalue) { + std::unique_ptr p; + makeMoveWrapper(std::move(p)); +} + +TEST(makeMoveWrapper, lvalue) { + std::unique_ptr p; + makeMoveWrapper(p); +} + +TEST(makeMoveWrapper, lvalue_copyable) { + std::shared_ptr p; + makeMoveWrapper(p); +} + +} // namespace folly