1/*
2 * Copyright 2015-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
17#include <folly/Unit.h>
18
19#include <folly/portability/GTest.h>
20
21using namespace folly;
22
23TEST(Unit, operatorEq) {
24 EXPECT_TRUE(Unit{} == Unit{});
25}
26
27TEST(Unit, operatorNe) {
28 EXPECT_FALSE(Unit{} != Unit{});
29}
30
31TEST(Unit, liftInt) {
32 using lifted = lift_unit_t<int>;
33 using actual = std::is_same<int, lifted>;
34 EXPECT_TRUE(actual::value);
35}
36
37TEST(Unit, liftUnit) {
38 using lifted = lift_unit_t<Unit>;
39 using actual = std::is_same<Unit, lifted>;
40 EXPECT_TRUE(actual::value);
41}
42
43TEST(Unit, liftVoid) {
44 using lifted = lift_unit_t<void>;
45 using actual = std::is_same<Unit, lifted>;
46 EXPECT_TRUE(actual::value);
47}
48
49TEST(Unit, dropInt) {
50 using dropped = drop_unit_t<int>;
51 using actual = std::is_same<int, dropped>;
52 EXPECT_TRUE(actual::value);
53}
54
55TEST(Unit, dropUnit) {
56 using dropped = drop_unit_t<Unit>;
57 using actual = std::is_same<void, dropped>;
58 EXPECT_TRUE(actual::value);
59}
60
61TEST(Unit, dropVoid) {
62 using dropped = drop_unit_t<void>;
63 using actual = std::is_same<void, dropped>;
64 EXPECT_TRUE(actual::value);
65}
66