]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/erl/test/test_thrift_3214.erl
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / lib / erl / test / test_thrift_3214.erl
1 %%
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
9 %%
10 %% http://www.apache.org/licenses/LICENSE-2.0
11 %%
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
17 %% under the License.
18 %%
19
20 -module(test_thrift_3214).
21 -compile(export_all).
22
23 -include("gen-erl/thrift3214_types.hrl").
24
25 -ifdef(TEST).
26 -ifndef(otp16_or_less).
27 -include_lib("eunit/include/eunit.hrl").
28
29 record_generation_test_() ->
30 [
31 {"StringMap record", ?_assertMatch(
32 {'StringMap', _},
33 #'StringMap'{data=#{50 => "foo"}}
34 )},
35 {"StringMap record defaults", ?_assertEqual(
36 {'StringMap', #{1 => "a", 2 => "b"}},
37 #'StringMap'{}
38 )},
39 {"StringMap record dict from list", ?_assertNotEqual(
40 {'StringMap', dict:from_list([{1, "a"}, {2, "b"}])},
41 #'StringMap'{}
42 )},
43 {"StringMap record map from list", ?_assertEqual(
44 {'StringMap', maps:from_list([{1, "a"}, {2, "b"}])},
45 #'StringMap'{}
46 )}
47 ].
48
49 struct_info_test_() ->
50 [
51 {"StringMap extended definition", ?_assertEqual(
52 {struct, [
53 {1, undefined, {map, i32, string}, 'data', #{1 => "a", 2 => "b"}}
54 ]},
55 thrift3214_types:struct_info_ext('StringMap')
56 )}
57 ].
58
59 -endif.
60 -endif.