~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/megaco/test/megaco_codec_prev3b_test.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%<copyright>
2
 
%% <year>2005-2007</year>
 
2
%% <year>2005-2008</year>
3
3
%% <holder>Ericsson AB, All Rights Reserved</holder>
4
4
%%</copyright>
5
5
%%<legalnotice>
133
133
         compact_otp6017_msg02/1,
134
134
         compact_otp6017_msg03/1,
135
135
 
 
136
         flex_compact_tickets/1, 
 
137
         flex_compact_otp7431_msg01/1,
 
138
         flex_compact_otp7431_msg02/1,
 
139
         flex_compact_otp7431_msg03/1,
 
140
         flex_compact_otp7431_msg04/1,
 
141
         flex_compact_otp7431_msg05/1,
 
142
         flex_compact_otp7431_msg06/1,
 
143
         flex_compact_otp7431_msg07/1,
 
144
 
136
145
         pretty_tickets/1, 
137
146
         pretty_otp4632_msg1/1, 
138
147
         pretty_otp4632_msg2/1, 
193
202
         flex_pretty_otp5803_msg02/1,
194
203
         flex_pretty_otp5805_msg01/1,
195
204
         flex_pretty_otp5836_msg01/1,
 
205
         flex_pretty_otp7431_msg01/1,
 
206
         flex_pretty_otp7431_msg02/1,
 
207
         flex_pretty_otp7431_msg03/1,
 
208
         flex_pretty_otp7431_msg04/1,
 
209
         flex_pretty_otp7431_msg05/1,
 
210
         flex_pretty_otp7431_msg06/1,
 
211
         flex_pretty_otp7431_msg07/1,
196
212
 
197
213
         init_per_testcase/2, fin_per_testcase/2]).  
198
214
 
420
436
tickets(suite) ->
421
437
    [
422
438
     compact_tickets,
 
439
     flex_compact_tickets,
423
440
     pretty_tickets,
424
441
     flex_pretty_tickets
425
442
    ].
472
489
     compact_otp6017_msg03
473
490
    ].
474
491
 
 
492
flex_compact_tickets(suite) ->
 
493
    {req, [],
 
494
     {conf, flex_compact_init, flex_compact_tickets_cases(),
 
495
      flex_compact_finish}}.
 
496
 
 
497
flex_compact_tickets_cases() ->
 
498
    [
 
499
     flex_compact_otp7431_msg01,
 
500
     flex_compact_otp7431_msg02,
 
501
     flex_compact_otp7431_msg03, 
 
502
     flex_compact_otp7431_msg04,
 
503
     flex_compact_otp7431_msg05,
 
504
     flex_compact_otp7431_msg06,
 
505
     flex_compact_otp7431_msg07
 
506
    ].
 
507
 
475
508
pretty_tickets(suite) ->
476
509
    [
477
510
     pretty_otp4632_msg1,
539
572
     flex_pretty_otp5803_msg01,
540
573
     flex_pretty_otp5803_msg02,
541
574
     flex_pretty_otp5805_msg01,
542
 
     flex_pretty_otp5836_msg01
 
575
     flex_pretty_otp5836_msg01,
 
576
     flex_pretty_otp7431_msg01,
 
577
     flex_pretty_otp7431_msg02,
 
578
     flex_pretty_otp7431_msg03, 
 
579
     flex_pretty_otp7431_msg04,
 
580
     flex_pretty_otp7431_msg05,
 
581
     flex_pretty_otp7431_msg06,
 
582
     flex_pretty_otp7431_msg07
543
583
    ].
544
584
 
545
585
                
746
786
    pretty_otp5836(compact_otp5836_msg1(), [Conf]).
747
787
 
748
788
 
 
789
flex_pretty_otp7431_msg01(suite) ->
 
790
    [];
 
791
flex_pretty_otp7431_msg01(Config) when list(Config) ->
 
792
    d("flex_pretty_otp7431_msg01 -> entry", []),
 
793
    ?ACQUIRE_NODES(1, Config),
 
794
    Conf = flex_scanner_conf(Config),
 
795
    flex_pretty_otp7431(ok, flex_pretty_otp7431_msg1(), [Conf]).
 
796
 
 
797
flex_pretty_otp7431_msg02(suite) ->
 
798
    [];
 
799
flex_pretty_otp7431_msg02(Config) when list(Config) ->
 
800
    %%     put(severity,trc),
 
801
    %%     put(dbg,true),
 
802
    d("flex_pretty_otp7431_msg02 -> entry", []),
 
803
    ?ACQUIRE_NODES(1, Config),
 
804
    Conf = flex_scanner_conf(Config),
 
805
    flex_pretty_otp7431(error, flex_pretty_otp7431_msg2(), [Conf]).
 
806
 
 
807
flex_pretty_otp7431_msg03(suite) ->
 
808
    [];
 
809
flex_pretty_otp7431_msg03(Config) when list(Config) ->
 
810
    %%     put(severity,trc),
 
811
    %%     put(dbg,true),
 
812
    d("flex_pretty_otp7431_msg03 -> entry", []),
 
813
    ?ACQUIRE_NODES(1, Config),
 
814
    Conf = flex_scanner_conf(Config),
 
815
    flex_pretty_otp7431(error, flex_pretty_otp7431_msg3(), [Conf]).
 
816
 
 
817
flex_pretty_otp7431_msg04(suite) ->
 
818
    [];
 
819
flex_pretty_otp7431_msg04(Config) when list(Config) ->
 
820
    d("flex_pretty_otp7431_msg04 -> entry", []),
 
821
    ?ACQUIRE_NODES(1, Config),
 
822
    Conf = flex_scanner_conf(Config),
 
823
    flex_pretty_otp7431(error, flex_pretty_otp7431_msg4(), [Conf]).
 
824
 
 
825
flex_pretty_otp7431_msg05(suite) ->
 
826
    [];
 
827
flex_pretty_otp7431_msg05(Config) when list(Config) ->
 
828
    d("flex_pretty_otp7431_msg05 -> entry", []),
 
829
    ?ACQUIRE_NODES(1, Config),
 
830
    Conf = flex_scanner_conf(Config),
 
831
    flex_pretty_otp7431(error, flex_pretty_otp7431_msg5(), [Conf]).
 
832
 
 
833
flex_pretty_otp7431_msg06(suite) ->
 
834
    [];
 
835
flex_pretty_otp7431_msg06(Config) when list(Config) ->
 
836
    d("flex_pretty_otp7431_msg06 -> entry", []),
 
837
    ?ACQUIRE_NODES(1, Config),
 
838
    Conf = flex_scanner_conf(Config),
 
839
    flex_pretty_otp7431(error, flex_pretty_otp7431_msg6(), [Conf]).
 
840
 
 
841
flex_pretty_otp7431_msg07(suite) ->
 
842
    [];
 
843
flex_pretty_otp7431_msg07(Config) when list(Config) ->
 
844
    d("flex_pretty_otp7431_msg07 -> entry", []),
 
845
    ?ACQUIRE_NODES(1, Config),
 
846
    Conf = flex_scanner_conf(Config),
 
847
    flex_pretty_otp7431(error, flex_pretty_otp7431_msg7(), [Conf]).
 
848
 
 
849
flex_pretty_otp7431(Expected, Msg, Conf) ->
 
850
    otp7431(Expected, megaco_pretty_text_encoder, Msg, Conf).
 
851
 
 
852
otp7431(Expected, Codec, Msg0, Conf) ->
 
853
    Bin0 = list_to_binary(Msg0),
 
854
    case decode_message(Codec, false, Conf, Bin0) of
 
855
        {ok, _Msg1} when Expected =:= ok ->
 
856
            io:format(" decoded", []);
 
857
        {error, {bad_property_parm, Reason}} when (Expected =:= error) andalso 
 
858
                                                  is_list(Reason) ->
 
859
            io:format("expected result: ~s", [Reason]),
 
860
            ok;
 
861
        Else ->
 
862
            io:format("unexpected result", []),
 
863
            exit({unexpected_decode_result, Else})
 
864
    end.
 
865
 
 
866
 
 
867
flex_pretty_otp7431_msg1() ->
 
868
    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
 
869
   Context = 2000 {
 
870
               Add = A4444,
 
871
               Add = A4445 {
 
872
                       Media {
 
873
                         Stream = 1 {
 
874
                                    Local { 
 
875
                                      v=0 
 
876
                                      o=- 2890844526 2890842807 IN IP4 124.124.124.222 
 
877
                                      s=- 
 
878
                                      t= 0 0 
 
879
                                      c=IN IP4 124.124.124.222 
 
880
                                      m=audio 2222 RTP/AVP 4 
 
881
                                      a=ptime:30 
 
882
                                      a=recvonly 
 
883
                                     } ; RTP profile for G.723.1 is 4
 
884
                                   }
 
885
                        }
 
886
                      }
 
887
              } 
 
888
       }".
 
889
 
 
890
flex_pretty_otp7431_msg2() ->
 
891
    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
 
892
   Context = 2000 {
 
893
               Add = A4444,
 
894
               Add = A4445 {
 
895
                       Media {
 
896
                         Stream = 1 {
 
897
                                    Local { 
 
898
                                      v=0 
 
899
                                      o=- 2890844526 2890842807 IN IP4 124.124.124.222 
 
900
                                      s=- 
 
901
                                      t= 0 0 
 
902
                                      c=IN IP4 124.124.124.222 
 
903
                                      m=audio 2222 RTP/AVP 4 
 
904
                                      a=ptime:30 
 
905
                                      a=             }
 
906
                                   }
 
907
                        }
 
908
                      }
 
909
              } 
 
910
       }".
 
911
 
 
912
flex_pretty_otp7431_msg3() ->
 
913
    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
 
914
   Context = 2000 {
 
915
               Add = A4444,
 
916
               Add = A4445 {
 
917
                       Media {
 
918
                         Stream = 1 {
 
919
                                    Local { 
 
920
                                      v=0 
 
921
                                      o=- 2890844526 2890842807 IN IP4 124.124.124.222 
 
922
                                      s=- 
 
923
                                      t= 0 0 
 
924
                                      c=IN IP4 124.124.124.222 
 
925
                                      m=audio 2222 RTP/AVP 4 
 
926
                                      a=ptime:30 
 
927
                                      a             }
 
928
                                   }
 
929
                        }
 
930
                      }
 
931
              } 
 
932
       }".
 
933
 
 
934
flex_pretty_otp7431_msg4() ->
 
935
    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
 
936
   Context = 2000 {
 
937
               Add = A4444,
 
938
               Add = A4445 {
 
939
                       Media {
 
940
                         Stream = 1 {
 
941
                                    Local { 
 
942
                                      v=0 
 
943
                                      o=- 2890844526 2890842807 IN IP4 124.124.124.222 
 
944
                                      s=- 
 
945
                                      t= 0 0 
 
946
                                      c=IN IP4 124.124.124.222 
 
947
                                      m=audio 2222 RTP/AVP 4 
 
948
                                      a=ptime:30 
 
949
                                      a}
 
950
                                   }
 
951
                        }
 
952
                      }
 
953
              } 
 
954
       }".
 
955
 
 
956
flex_pretty_otp7431_msg5() ->
 
957
    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
 
958
   Context = 2000 {
 
959
               Add = A4444,
 
960
               Add = A4445 {
 
961
                       Media {
 
962
                         Stream = 1 {
 
963
                                    Local { 
 
964
                                      v=            }
 
965
                                   }
 
966
                        }
 
967
                      }
 
968
              } 
 
969
       }".
 
970
 
 
971
flex_pretty_otp7431_msg6() ->
 
972
    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
 
973
   Context = 2000 {
 
974
               Add = A4444,
 
975
               Add = A4445 {
 
976
                       Media {
 
977
                         Stream = 1 {
 
978
                                    Local { 
 
979
                                      v            }
 
980
                                   }
 
981
                        }
 
982
                      }
 
983
              } 
 
984
       }".
 
985
 
 
986
flex_pretty_otp7431_msg7() ->
 
987
    "MEGACO/" ?VERSION_STR " [124.124.124.222]:55555 Reply = 10003 {
 
988
   Context = 2000 {
 
989
               Add = A4444,
 
990
               Add = A4445 {
 
991
                       Media {
 
992
                         Stream = 1 {
 
993
                                    Local { 
 
994
                                      v}
 
995
                                   }
 
996
                        }
 
997
                      }
 
998
              } 
 
999
       }".
 
1000
 
 
1001
 
 
1002
 
749
1003
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
750
1004
 
751
1005
compact_test_msgs(suite) ->
2414
2668
 
2415
2669
%% ==============================================================
2416
2670
%%
 
2671
%% F l e x   C o m p a c t   T e s t c a s e s
 
2672
%%
 
2673
 
 
2674
flex_compact_otp7431_msg01(suite) ->
 
2675
    [];
 
2676
flex_compact_otp7431_msg01(Config) when list(Config) ->
 
2677
    %% put(severity,trc),
 
2678
    %% put(dbg,true),
 
2679
    d("flex_comppact_otp7431_msg01 -> entry", []),
 
2680
    Conf = flex_scanner_conf(Config),
 
2681
    flex_compact_otp7431(ok, flex_compact_otp7431_msg1(), [Conf]).
 
2682
 
 
2683
flex_compact_otp7431_msg02(suite) ->
 
2684
    [];
 
2685
flex_compact_otp7431_msg02(Config) when list(Config) ->
 
2686
    %% put(severity,trc),
 
2687
    %% put(dbg,true),
 
2688
    d("flex_comppact_otp7431_msg02 -> entry", []),
 
2689
    Conf = flex_scanner_conf(Config),
 
2690
    flex_compact_otp7431(error, flex_compact_otp7431_msg2(), [Conf]).
 
2691
 
 
2692
flex_compact_otp7431_msg03(suite) ->
 
2693
    [];
 
2694
flex_compact_otp7431_msg03(Config) when list(Config) ->
 
2695
    %% put(severity,trc),
 
2696
    %% put(dbg,true),
 
2697
    d("flex_comppact_otp7431_msg03 -> entry", []),
 
2698
    Conf = flex_scanner_conf(Config),
 
2699
    flex_compact_otp7431(error, flex_compact_otp7431_msg3(), [Conf]).
 
2700
 
 
2701
flex_compact_otp7431_msg04(suite) ->
 
2702
    [];
 
2703
flex_compact_otp7431_msg04(Config) when list(Config) ->
 
2704
    %% put(severity,trc),
 
2705
    %% put(dbg,true),
 
2706
    d("flex_comppact_otp7431_msg04 -> entry", []),
 
2707
    Conf = flex_scanner_conf(Config),
 
2708
    flex_compact_otp7431(error, flex_compact_otp7431_msg4(), [Conf]).
 
2709
 
 
2710
flex_compact_otp7431_msg05(suite) ->
 
2711
    [];
 
2712
flex_compact_otp7431_msg05(Config) when list(Config) ->
 
2713
    %% put(severity,trc),
 
2714
    %% put(dbg,true),
 
2715
    d("flex_comppact_otp7431_msg05 -> entry", []),
 
2716
    Conf = flex_scanner_conf(Config),
 
2717
    flex_compact_otp7431(error, flex_compact_otp7431_msg5(), [Conf]).
 
2718
 
 
2719
flex_compact_otp7431_msg06(suite) ->
 
2720
    [];
 
2721
flex_compact_otp7431_msg06(Config) when list(Config) ->
 
2722
    %% put(severity,trc),
 
2723
    %% put(dbg,true),
 
2724
    d("flex_comppact_otp7431_msg06 -> entry", []),
 
2725
    Conf = flex_scanner_conf(Config),
 
2726
    flex_compact_otp7431(error, flex_compact_otp7431_msg6(), [Conf]).
 
2727
 
 
2728
flex_compact_otp7431_msg07(suite) ->
 
2729
    [];
 
2730
flex_compact_otp7431_msg07(Config) when list(Config) ->
 
2731
    %% put(severity,trc),
 
2732
    %% put(dbg,true),
 
2733
    d("flex_comppact_otp7431_msg07 -> entry", []),
 
2734
    Conf = flex_scanner_conf(Config),
 
2735
    flex_compact_otp7431(error, flex_compact_otp7431_msg7(), [Conf]).
 
2736
 
 
2737
 
 
2738
flex_compact_otp7431(Expected, Msg, Conf) ->
 
2739
    otp7431(Expected, megaco_compact_text_encoder, Msg, Conf).
 
2740
 
 
2741
flex_compact_otp7431_msg1() ->
 
2742
    "!/1 [124.124.124.222]:55555
 
2743
P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
 
2744
v=0
 
2745
o=- 2890844526 2890842807 IN IP4 124.124.124.222
 
2746
s=-
 
2747
t= 0 0
 
2748
c=IN IP4 124.124.124.222
 
2749
m=audio 2222 RTP/AVP 4
 
2750
a=ptime:30
 
2751
a=recvonly
 
2752
}}}}}}".
 
2753
 
 
2754
flex_compact_otp7431_msg2() ->
 
2755
    "!/1 [124.124.124.222]:55555
 
2756
P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
 
2757
v=0
 
2758
o=- 2890844526 2890842807 IN IP4 124.124.124.222
 
2759
s=-
 
2760
t= 0 0
 
2761
c=IN IP4 124.124.124.222
 
2762
m=audio 2222 RTP/AVP 4
 
2763
a=ptime:30
 
2764
a=     }
 
2765
}}}}}".
 
2766
 
 
2767
 
 
2768
flex_compact_otp7431_msg3() ->
 
2769
    "!/1 [124.124.124.222]:55555
 
2770
P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
 
2771
v=0
 
2772
o=- 2890844526 2890842807 IN IP4 124.124.124.222
 
2773
s=-
 
2774
t= 0 0
 
2775
c=IN IP4 124.124.124.222
 
2776
m=audio 2222 RTP/AVP 4
 
2777
a=ptime:30
 
2778
a     }
 
2779
}}}}}".
 
2780
 
 
2781
 
 
2782
flex_compact_otp7431_msg4() ->
 
2783
    "!/1 [124.124.124.222]:55555
 
2784
P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
 
2785
v=0
 
2786
o=- 2890844526 2890842807 IN IP4 124.124.124.222
 
2787
s=-
 
2788
t= 0 0
 
2789
c=IN IP4 124.124.124.222
 
2790
m=audio 2222 RTP/AVP 4
 
2791
a=ptime:30
 
2792
a}
 
2793
}}}}}".
 
2794
 
 
2795
 
 
2796
flex_compact_otp7431_msg5() ->
 
2797
    "!/1 [124.124.124.222]:55555
 
2798
P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
 
2799
v=       }
 
2800
}}}}}".
 
2801
 
 
2802
 
 
2803
flex_compact_otp7431_msg6() ->
 
2804
    "!/1 [124.124.124.222]:55555
 
2805
P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
 
2806
v       }
 
2807
}}}}}".
 
2808
 
 
2809
flex_compact_otp7431_msg7() ->
 
2810
    "!/1 [124.124.124.222]:55555
 
2811
P=10003{C=2000{A=a4444,A=a4445{M{ST=1{L{
 
2812
v}
 
2813
}}}}}".
 
2814
 
 
2815
 
 
2816
%% ==============================================================
 
2817
%%
2417
2818
%% P r e t t y   T e s t c a s e s
2418
2819
%%
2419
2820