X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Ftest%2FReplaceableTest.cpp;fp=folly%2Ftest%2FReplaceableTest.cpp;h=6ab885095bcd1ebf8b6ca26836375d52d83b7381;hb=efc4ca1ecfa090028b6260f7d77373ebd0aa8b45;hp=00eb01d9867ba38fa45de2d3bfeaf90ba853436d;hpb=890625b2c781b779f65a835e7c7c610c95f010c0;p=folly.git diff --git a/folly/test/ReplaceableTest.cpp b/folly/test/ReplaceableTest.cpp index 00eb01d9..6ab88509 100644 --- a/folly/test/ReplaceableTest.cpp +++ b/folly/test/ReplaceableTest.cpp @@ -22,6 +22,7 @@ using namespace ::testing; using namespace ::folly; namespace { +struct Basic {}; struct alignas(128) BigAlign {}; struct HasConst final { bool const b1; @@ -81,6 +82,7 @@ using StaticAttributeTypes = ::testing::Types< float, double, char[11], + Basic, BigAlign, HasConst, HasRef, @@ -250,6 +252,18 @@ TEST(ReplaceableTest, Basics) { EXPECT_TRUE(rHasConstB->b1); } +TEST(ReplaceableTest, Constructors) { + Basic b{}; + // From existing `T` + auto rBasicCopy1 = Replaceable(b); + auto rBasicMove1 = Replaceable(std::move(b)); + // From existing `Replaceable` + auto rBasicCopy2 = Replaceable(rBasicCopy1); + auto rBasicMove2 = Replaceable(std::move(rBasicMove1)); + (void)rBasicCopy2; + (void)rBasicMove2; +} + TEST(ReplaceableTest, DestructsWhenExpected) { int i{0}; {