2 * Copyright 2016 Facebook, Inc.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include <gtest/gtest.h>
19 #include <folly/Unit.h>
21 using namespace folly;
23 TEST(Unit, operatorEq) {
24 EXPECT_TRUE(Unit{} == Unit{});
27 TEST(Unit, operatorNe) {
28 EXPECT_FALSE(Unit{} != Unit{});
32 using lifted = Unit::Lift<int>;
33 using actual = std::is_same<int, lifted::type>;
34 EXPECT_TRUE(actual::value);
37 TEST(Unit, liftUnit) {
38 using lifted = Unit::Lift<Unit>;
39 using actual = std::is_same<Unit, lifted::type>;
40 EXPECT_TRUE(actual::value);
43 TEST(Unit, liftVoid) {
44 using lifted = Unit::Lift<void>;
45 using actual = std::is_same<Unit, lifted::type>;
46 EXPECT_TRUE(actual::value);
50 using dropped = Unit::Drop<int>;
51 using actual = std::is_same<int, dropped::type>;
52 EXPECT_TRUE(actual::value);
55 TEST(Unit, dropUnit) {
56 using dropped = Unit::Drop<Unit>;
57 using actual = std::is_same<void, dropped::type>;
58 EXPECT_TRUE(actual::value);
61 TEST(Unit, dropVoid) {
62 using dropped = Unit::Drop<void>;
63 using actual = std::is_same<void, dropped::type>;
64 EXPECT_TRUE(actual::value);