2 * Copyright (c) Facebook, Inc. and its affiliates.
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 <thrift/test/reflection/gen-cpp2/reflection_visitation.h>
19 #include <folly/Overload.h>
20 #include <folly/portability/GTest.h>
22 using namespace apache::thrift
;
26 namespace cpp_reflection
{
27 TEST(dep_C_struct
, test_transitivity
) {
31 for_each_field(s
, [](auto&&, auto&& ref
) {
33 [](int32_t i
) { EXPECT_EQ(i
, 10); },
35 for_each_field(d
, [](auto&&, auto&& ref
) { EXPECT_EQ(*ref
, 20); });
39 TEST(union1
, test_union
) {
42 visit_union(s
, [](auto&&, auto&& value
) {
44 [](string
& s
) { EXPECT_EQ(s
, "foo"); },
45 [](auto&&) { EXPECT_TRUE(false); })(value
);
48 } // namespace cpp_reflection
49 } // namespace test_cpp2