/*
- * Copyright 2016 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.
#include <map>
#include <memory>
#include <string>
-#include <gtest/gtest.h>
+
#include <folly/Memory.h>
+#include <folly/portability/GTest.h>
using namespace std;
using namespace folly;
EXPECT_EQ(1, state);
}
+TEST_F(IndestructibleTest, empty) {
+ static const Indestructible<map<string, int>> data;
+ auto& m = *data;
+ EXPECT_EQ(0, m.size());
+}
+
TEST_F(IndestructibleTest, move) {
int state = 0;
int value = 0;
EXPECT_EQ(1, state);
EXPECT_EQ(2, moves);
}
+
+TEST_F(IndestructibleTest, disabled_default_ctor) {
+ EXPECT_TRUE((std::is_constructible<Indestructible<int>>::value)) << "sanity";
+
+ struct Foo {
+ Foo(int) {}
+ };
+ EXPECT_FALSE((std::is_constructible<Indestructible<Foo>>::value));
+ EXPECT_FALSE((std::is_constructible<Indestructible<Foo>, Magic>::value));
+ EXPECT_TRUE((std::is_constructible<Indestructible<Foo>, int>::value));
+}