4
%% Copyright Ericsson AB 2003-2009. All Rights Reserved.
4
%% Copyright Ericsson AB 2003-2010. All Rights Reserved.
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
63
64
init_per_testcase(_Case, Config) when is_list(Config) ->
66
fin_per_testcase(_Case, Config) when is_list(Config) ->
67
end_per_testcase(_Case, Config) when is_list(Config) ->
69
71
%%======================================================================
70
72
%% Test case definitions
71
73
%%======================================================================
78
[{tickets, [], [otp7575, otp8563]}].
80
init_per_group(_GroupName, Config) ->
83
end_per_group(_GroupName, Config) ->
127
otp8563(suite) -> [];
128
otp8563(doc) -> ["OTP-8563"];
129
otp8563(Config) when is_list(Config) ->
130
Val1 = 16#7fffffffffffffff,
131
io:format("try encode and decode ~w~n", [Val1]),
132
Enc1 = snmp_pdus:enc_value('Counter64', Val1),
133
{{'Counter64', Val1}, []} = snmp_pdus:dec_value(Enc1),
136
io:format("try encode and decode ~w~n", [Val2]),
137
Enc2 = snmp_pdus:enc_value('Counter64', Val2),
138
{{'Counter64', Val2}, []} = snmp_pdus:dec_value(Enc2),
141
io:format("try encode and decode ~w~n", [Val3]),
142
Enc3 = snmp_pdus:enc_value('Counter64', Val3),
143
{{'Counter64', Val3}, []} = snmp_pdus:dec_value(Enc3),
145
Val4 = 16#fffffffffffffffe,
146
io:format("try encode and decode ~w~n", [Val4]),
147
Enc4 = snmp_pdus:enc_value('Counter64', Val4),
148
{{'Counter64', Val4}, []} = snmp_pdus:dec_value(Enc4),
151
io:format("try encode and decode ~w~n", [Val5]),
152
Enc5 = snmp_pdus:enc_value('Counter64', Val5),
153
{{'Counter64', Val5}, []} = snmp_pdus:dec_value(Enc5),
155
Val6 = 16#ffffffffffffffff + 1,
156
io:format("try and fail to encode ~w~n", [Val6]),
157
case (catch snmp_pdus:enc_value('Counter64', Val6)) of
158
{'EXIT', {error, {bad_counter64, Val6}}} ->
161
exit({unexpected_encode_result, Unexpected6, Val6})
165
io:format("try and fail to encode ~w~n", [Val7]),
166
case (catch snmp_pdus:enc_value('Counter64', Val7)) of
167
{'EXIT', {error, {bad_counter64, Val7}}} ->
170
exit({unexpected_encode_result, Unexpected7, Val7})
121
176
%%======================================================================
122
177
%% Internal functions
123
178
%%======================================================================