2 %% Licensed to the Apache Software Foundation (ASF) under one
3 %% or more contributor license agreements. See the NOTICE file
4 %% distributed with this work for additional information
5 %% regarding copyright ownership. The ASF licenses this file
6 %% to you under the Apache License, Version 2.0 (the
7 %% "License"); you may not use this file except in compliance
8 %% with the License. You may obtain a copy of the License at
10 %% http://www.apache.org/licenses/LICENSE-2.0
12 %% Unless required by applicable law or agreed to in writing,
13 %% software distributed under the License is distributed on an
14 %% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 %% KIND, either express or implied. See the License for the
16 %% specific language governing permissions and limitations
20 -module(test_thrift_3214).
23 -include("gen-erl/thrift3214_types.hrl").
26 -ifndef(otp16_or_less).
27 -include_lib("eunit/include/eunit.hrl").
29 record_generation_test_() ->
31 {"StringMap record", ?_assertMatch(
33 #'StringMap'{data=#{50 => "foo"}}
35 {"StringMap record defaults", ?_assertEqual(
36 {'StringMap', #{1 => "a", 2 => "b"}},
39 {"StringMap record dict from list", ?_assertNotEqual(
40 {'StringMap', dict:from_list([{1, "a"}, {2, "b"}])},
43 {"StringMap record map from list", ?_assertEqual(
44 {'StringMap', maps:from_list([{1, "a"}, {2, "b"}])},
49 struct_info_test_() ->
51 {"StringMap extended definition", ?_assertEqual(
53 {1, undefined, {map, i32, string}, 'data', #{1 => "a", 2 => "b"}}
55 thrift3214_types:struct_info_ext('StringMap')