proxygen
StaticSingletonManagerTest.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2018-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
20 
21 namespace folly {
22 namespace detail {
23 
25 
26 template <typename T>
27 struct Tag {};
28 
30  auto make3 = [n = 3] { return new int(n); };
31  auto i = createGlobal<int, Tag<char>>(make3);
32  ASSERT_NE(nullptr, i);
33  EXPECT_EQ(3, *i);
34 
35  auto const make4 = [n = 4] { return new int(n); };
36  auto j = createGlobal<int, Tag<char>>(make4);
37  ASSERT_NE(nullptr, j);
38  EXPECT_EQ(i, j);
39  EXPECT_EQ(3, *j);
40 
41  auto make5 = [n = 5] { return new int(n); };
42  auto k = createGlobal<int, Tag<char*>>(std::move(make5));
43  ASSERT_NE(nullptr, k);
44  EXPECT_NE(i, k);
45  EXPECT_EQ(5, *k);
46 }
47 
48 } // namespace detail
49 } // namespace folly
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
Definition: lib.cpp:18
TEST_F(StaticSingletonManagerTest, example)
#define EXPECT_NE(val1, val2)
Definition: gtest.h:1926
#define ASSERT_NE(val1, val2)
Definition: gtest.h:1960
KeyT k