Skip to content
This repository
Newer
Older
100644 53 lines (47 sloc) 2.789 kb
180bb0d2 »
2009-10-06 refactor types to differentiate between amf data types
1 -module (decoder_test).
2 -author("trung@mdkt.org").
3 -include_lib("eunit/include/eunit.hrl").
4 -compile(export_all).
5
6
7
8 read_ping_msg_test() ->
9 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,
10 1,17,10,129,19,77,102,108,101,120,46,109,101,115,115,97,103,
11 105,110,103,46,109,101,115,115,97,103,101,115,46,67,111,109,
12 109,97,110,100,77,101,115,115,97,103,101,19,111,112,101,114,
13 97,116,105,111,110,27,99,111,114,114,101,108,97,116,105,111,
14 110,73,100,19,109,101,115,115,97,103,101,73,100,15,104,101,97,
15 100,101,114,115,9,98,111,100,121,17,99,108,105,101,110,116,73,
16 100,21,116,105,109,101,84,111,76,105,118,101,19,116,105,109,
17 101,115,116,97,109,112,23,100,101,115,116,105,110,97,116,105,
18 111,110,4,5,6,1,6,73,54,53,57,68,52,54,68,49,45,48,49,51,56,
19 45,50,70,56,68,45,52,65,57,67,45,49,48,55,68,57,48,68,57,66,
20 51,70,65,10,11,1,9,68,83,73,100,6,7,110,105,108,37,68,83,77,
21 101,115,115,97,103,105,110,103,86,101,114,115,105,111,110,4,1,
22 1,10,5,1,1,4,0,4,0,6,1>>,
23
24 Msg = decoder:read(MsgBin),
25 ?debugFmt("~p~n", [Msg]).
26
27 read_sample_message_test() ->
28 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,
29 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,
30 120,46,109,101,115,115,97,103,105,110,103,46,105,111,46,65,114,114,97,
31 121,67,111,108,108,101,99,116,105,111,110,9,3,1,10,83,79,102,108,101,
32 120,46,109,101,115,115,97,103,105,110,103,46,109,101,115,115,97,103,
33 101,115,46,82,101,109,111,116,105,110,103,77,101,115,115,97,103,101,
34 15,104,101,97,100,101,114,115,9,98,111,100,121,19,111,112,101,114,97,
35 116,105,111,110,19,109,101,115,115,97,103,101,73,100,23,100,101,115,
36 116,105,110,97,116,105,111,110,10,35,1,27,112,114,105,110,99,105,112,
37 97,108,78,97,109,101,23,99,114,101,100,101,110,116,105,97,108,115,6,
38 21,115,97,109,112,108,101,117,115,101,114,6,29,115,97,109,112,108,101,
39 112,97,115,115,119,111,114,100,6,23,72,101,108,108,111,32,87,111,114,
40 108,100,6,21,101,99,104,111,79,98,106,101,99,116,4,1,6,15,116,101,115,
41 116,105,110,103,0,18,116,101,115,116,105,110,103,46,101,99,104,111,79,
42 98,106,101,99,116,0,2,47,50,0,0,0,0,17,10,7,67,102,108,101,120,46,109,
43 101,115,115,97,103,105,110,103,46,105,111,46,65,114,114,97,121,67,111,
44 108,108,101,99,116,105,111,110,9,3,1,6,23,72,101,108,108,111,32,87,111,
45 114,108,100,0,18,116,101,115,116,105,110,103,46,101,99,104,111,79,98,
46 106,101,99,116,0,2,47,51,0,0,0,0,17,10,7,67,102,108,101,120,46,109,101,
47 115,115,97,103,105,110,103,46,105,111,46,65,114,114,97,121,67,111,108,
48 108,101,99,116,105,111,110,9,3,1,10,51,1,15,104,101,97,100,101,114,115,
49 11,95,102,108,97,103,9,98,111,100,121,10,1,9,1,1,6,17,69,110,118,101,
50 108,111,112,101,6,23,72,101,108,108,111,32,87,111,114,108,100,147>>,
51
52 Msg = decoder:read(MsgBin),
53 ?debugFmt("~p~n", [Msg]).
Something went wrong with that request. Please try again.