summaryrefslogtreecommitdiffstats
path: root/test/sua_codec_tests.erl
blob: 6a6f16e39e47014533ccb08eb539cffaa8e78849 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-module(sua_codec_tests).
-author('Harald Welte <laforge@gnumonks.org>').

-include_lib("eunit/include/eunit.hrl").

-include("sua.hrl").


-define(MSG_ENC, <<1,0,7,1,0,0,0,208,0,6,0,8,0,0,0,3,1,21,0,8,0,0,0,1,1,2,0,44,0,1,0,7,128,1,0,20,0,0,0,4,12,0,1,4,68,119,121,7,22,0,0,0,128,2,0,8,0,0,8,21,128,3,0,8,0,0,0,7,1,3,0,44,0,1,0,7,128,1,0,20,0,0,0,4,15,0,7,4,8,18,17,9,97,16,81,1,128,2,0,8,0,0,8,22,128,3,0,8,0,0,0,6,1,22,0,8,0,0,0,0,1,11,0,86,98,80,72,4,0,0,32,64,107,26,40,24,6,7,0,17,134,5,1,1,1,160,13,96,11,161,9,6,7,4,0,0,1,0,1,3,108,44,161,42,2,1,0,2,1,2,48,34,4,8,0,1,17,9,97,16,81,241,129,7,145,8,18,1,0,0,242,4,7,145,68,119,121,7,22,0,166,4,128,2,6,192,0,0>>).
-define(MSG_DEC, {sua_msg,1,7,1,[{6,{4,<<0,0,0,3>>}},{277,{4,<<0,0,0,1>>}},{258,{40,<<0,1,0,7,128,1,0,20,0,0,0,4,12,0,1,4,68,119,121,7,22,0,0,0,128,2,0,8,0,0,8,21,128,3,0,8,0,0,0,7>>}},{259,{40,<<0,1,0,7,128,1,0,20,0,0,0,4,15,0,7,4,8,18,17,9,97,16,81,1,128,2,0,8,0,0,8,22,128,3,0,8,0,0,0,6>>}},{278,{4,<<0,0,0,0>>}},{267,{82,<<98,80,72,4,0,0,32,64,107,26,40,24,6,7,0,17,134,5,1,1,1,160,13,96,11,161,9,6,7,4,0,0,1,0,1,3,108,44,161,42,2,1,0,2,1,2,48,34,4,8,0,1,17,9,97,16,81,241,129,7,145,8,18,1,0,0,242,4,7,145,68,119,121,7,22,0,166,4,128,2,6,192>>}}]}).


dec_test() ->
	?assertEqual(?MSG_DEC, sua_codec:parse_msg(?MSG_ENC)).
enc_test() ->
	?assertEqual(?MSG_ENC, sua_codec:encode_msg(?MSG_DEC)).