/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include namespace apache::thrift::test::testset { namespace { using namespace apache::thrift::type; template struct SameType; template struct SameType {}; TEST(TestsetTest, StructWith) { SameType>(); SameType< struct_optional_float, struct_with>(); SameType< struct_optional_list_bool_cpp_ref, struct_with< list, FieldModifier::Optional, FieldModifier::Reference>>(); // Order of field modifiers doesn't matter. SameType< struct_optional_list_bool_cpp_ref, struct_with< list, FieldModifier::Reference, FieldModifier::Optional>>(); } TEST(TestsetTest, ExceptionWith) { SameType>(); SameType< exception_optional_float, exception_with>(); SameType< exception_optional_list_bool_cpp_ref, exception_with< list, FieldModifier::Optional, FieldModifier::Reference>>(); // Order of field modifiers doesn't matter. SameType< exception_optional_list_bool_cpp_ref, exception_with< list, FieldModifier::Reference, FieldModifier::Optional>>(); } TEST(TestsetTest, UnionWith) { SameType>>(); SameType< union_map_string_binary_cpp_ref, union_with, FieldModifier::Reference>>(); } TEST(TestsetTest, CppRef) { struct_optional_list_bool_cpp_ref s; static_assert(std::is_same_v< folly::remove_cvref_t, std::unique_ptr>>); } } // namespace } // namespace apache::thrift::test::testset