summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-01-18 00:29:56 +0100
committerHarald Welte <laforge@gnumonks.org>2012-01-18 00:29:56 +0100
commit6b77daa02690f7a02d6fd0b1105de81d38e41331 (patch)
tree359deceeafd47e474eaa6a9dbe4c0e93c6131ce6
parent8e92c9a46e6c3cb8909297f60a3b6928527b201e (diff)
add very basic sua decode / re-encode test
-rw-r--r--test/sua_codec_tests.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/sua_codec_tests.erl b/test/sua_codec_tests.erl
new file mode 100644
index 0000000..eace88e
--- /dev/null
+++ b/test/sua_codec_tests.erl
@@ -0,0 +1,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,204,[{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)).