Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: df7aab98cd
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (47 sloc) 2.789 kb
-module (decoder_test).
-author("trung@mdkt.org").
-include_lib("eunit/include/eunit.hrl").
-compile(export_all).
read_ping_msg_test() ->
MsgBin = <<0,3,0,0,0,1,0,4,110,117,108,108,0,2,47,49,0,0,0,224,10,0,0,0,
1,17,10,129,19,77,102,108,101,120,46,109,101,115,115,97,103,
105,110,103,46,109,101,115,115,97,103,101,115,46,67,111,109,
109,97,110,100,77,101,115,115,97,103,101,19,111,112,101,114,
97,116,105,111,110,27,99,111,114,114,101,108,97,116,105,111,
110,73,100,19,109,101,115,115,97,103,101,73,100,15,104,101,97,
100,101,114,115,9,98,111,100,121,17,99,108,105,101,110,116,73,
100,21,116,105,109,101,84,111,76,105,118,101,19,116,105,109,
101,115,116,97,109,112,23,100,101,115,116,105,110,97,116,105,
111,110,4,5,6,1,6,73,54,53,57,68,52,54,68,49,45,48,49,51,56,
45,50,70,56,68,45,52,65,57,67,45,49,48,55,68,57,48,68,57,66,
51,70,65,10,11,1,9,68,83,73,100,6,7,110,105,108,37,68,83,77,
101,115,115,97,103,105,110,103,86,101,114,115,105,111,110,4,1,
1,10,5,1,1,4,0,4,0,6,1>>,
Msg = decoder:read(MsgBin),
?debugFmt("~p~n", [Msg]).
read_sample_message_test() ->
MsgBin = <<0,3,0,1,0,12,68,85,77,77,89,95,72,69,65,68,69,82,1,0,0,0,0,2,0,
7,78,79,84,72,73,78,71,0,3,0,0,0,2,47,49,0,0,0,0,17,10,7,67,102,108,101,
120,46,109,101,115,115,97,103,105,110,103,46,105,111,46,65,114,114,97,
121,67,111,108,108,101,99,116,105,111,110,9,3,1,10,83,79,102,108,101,
120,46,109,101,115,115,97,103,105,110,103,46,109,101,115,115,97,103,
101,115,46,82,101,109,111,116,105,110,103,77,101,115,115,97,103,101,
15,104,101,97,100,101,114,115,9,98,111,100,121,19,111,112,101,114,97,
116,105,111,110,19,109,101,115,115,97,103,101,73,100,23,100,101,115,
116,105,110,97,116,105,111,110,10,35,1,27,112,114,105,110,99,105,112,
97,108,78,97,109,101,23,99,114,101,100,101,110,116,105,97,108,115,6,
21,115,97,109,112,108,101,117,115,101,114,6,29,115,97,109,112,108,101,
112,97,115,115,119,111,114,100,6,23,72,101,108,108,111,32,87,111,114,
108,100,6,21,101,99,104,111,79,98,106,101,99,116,4,1,6,15,116,101,115,
116,105,110,103,0,18,116,101,115,116,105,110,103,46,101,99,104,111,79,
98,106,101,99,116,0,2,47,50,0,0,0,0,17,10,7,67,102,108,101,120,46,109,
101,115,115,97,103,105,110,103,46,105,111,46,65,114,114,97,121,67,111,
108,108,101,99,116,105,111,110,9,3,1,6,23,72,101,108,108,111,32,87,111,
114,108,100,0,18,116,101,115,116,105,110,103,46,101,99,104,111,79,98,
106,101,99,116,0,2,47,51,0,0,0,0,17,10,7,67,102,108,101,120,46,109,101,
115,115,97,103,105,110,103,46,105,111,46,65,114,114,97,121,67,111,108,
108,101,99,116,105,111,110,9,3,1,10,51,1,15,104,101,97,100,101,114,115,
11,95,102,108,97,103,9,98,111,100,121,10,1,9,1,1,6,17,69,110,118,101,
108,111,112,101,6,23,72,101,108,108,111,32,87,111,114,108,100,147>>,
Msg = decoder:read(MsgBin),
?debugFmt("~p~n", [Msg]).
Jump to Line
Something went wrong with that request. Please try again.