| module Test { |
| |
| import from BSSGP_Helper_Functions all; |
| import from BSSGP_Types all; |
| |
| type component dummy_CT { |
| } |
| |
| function f_assert_prepr(in octetstring a, in octetstring b) { |
| log ("Input: ", a); |
| log ("Expected: ", b); |
| var octetstring a_preprocessed := f_BSSGP_preprocess_pdu(a); |
| log ("Preprocessed: ", a_preprocessed); |
| |
| if (a_preprocessed != b) { |
| setverdict(fail); |
| } else { |
| setverdict(pass); |
| } |
| } |
| |
| function f_dec_and_log(in octetstring inp) { |
| log("Input: ", inp); |
| var octetstring inp_p := f_BSSGP_preprocess_pdu(inp); |
| log ("Preprocessed: ", inp_p); |
| var BssgpPdu dec := dec_BssgpPdu(inp_p); |
| log("Decoded: ", dec); |
| } |
| |
| testcase TC_selftest() runs on dummy_CT { |
| const octetstring c_bvc_reset_pcu := '2204820000078108088832f44000c80051e0'O; |
| const octetstring c_bvc_reset_q := '2204820000078100'O; |
| const octetstring c_status_pcu := '4107810515882204820000078103'O; |
| const octetstring c_reset_ack_q := '2304820000'O; |
| const octetstring c_reset_ack_pcu := '23048200c4'O; |
| const octetstring c_unblock_pcu := '24048200c4'O; |
| const octetstring c_unblock_ack_q := '25048200c4'O; |
| const octetstring c_fc_bvc_pcu := '261e8101058200fa038200c8018200fa1c8200c806820000'O; |
| const octetstring c_fc_bvc_ack_q := '271e8101'O; |
| const octetstring c_gmm_mo_att_req := '01bb146ddd000004088832f44000c80051e000800e003b01c001080103e5e000110a0005f4fb146ddd32f44000c8001d1b53432b37159ef9090070000dd9c6321200e00019b32c642401c0002017057bf0ec'O; |
| const octetstring c_gmm_mt_ac_req := '00bb146ddd0050001682ffff0a8204030e9c41c001081200102198c72477ea104895e8b959acc58b108182f4d045'O; |
| const octetstring c_gmm_mo_ac_resp := '01bb146ddd000004088832f44000c80051e000800e000e01c00508130122fa361f5fdd623d'O; |
| const octetstring c_gmm_mt_att_acc := '00bb146ddd0050001682ffff0a8204030e9841c005080201340432f44000c8001805f4fb146ddd0967d0'O; |
| const octetstring c_gmm_mt_det_req := '00bb146ddd0050001682ffff0a8204030e8941c00908050215f0b6'O; |
| const octetstring c_gmm_mo_att_cpl := '01fb146ddd000004088832f44000c80051e000800e000801c009080339d7bc'O; |
| |
| /* single byte length to two byte length */ |
| f_assert_prepr('04058101'O, '0405000101'O); |
| f_assert_prepr('040589000102030405060708'O, '04050009000102030405060708'O); |
| /* two byte length to two byte length */ |
| f_assert_prepr('0405000101'O, '0405000101'O); |
| /* special case: DL-UD + UL-UD */ |
| f_assert_prepr('00aabbccddeeffaa29822342'O, '00aabbccddeeffaa2900022342'O); |
| f_assert_prepr('01aabbccddeeffaa29822342'O, '01aabbccddeeffaa2900022342'O); |
| /* multiple TLVs */ |
| f_assert_prepr('234281aa4382bbbb'O, '23420001aa430002bbbb'O); |
| f_assert_prepr('230080'O, '23000000'O); |
| |
| f_dec_and_log(c_bvc_reset_pcu); |
| f_dec_and_log(c_bvc_reset_q); |
| f_dec_and_log(c_status_pcu); |
| f_dec_and_log(c_reset_ack_q); |
| f_dec_and_log(c_reset_ack_pcu); |
| f_dec_and_log(c_unblock_pcu); |
| f_dec_and_log(c_unblock_ack_q); |
| f_dec_and_log(c_fc_bvc_pcu); |
| f_dec_and_log(c_fc_bvc_ack_q); |
| f_dec_and_log(c_gmm_mo_att_req); |
| f_dec_and_log(c_gmm_mt_ac_req); |
| f_dec_and_log(c_gmm_mo_ac_resp); |
| f_dec_and_log(c_gmm_mt_att_acc); |
| f_dec_and_log(c_gmm_mt_det_req); |
| f_dec_and_log(c_gmm_mo_att_cpl); |
| } |
| |
| control { |
| execute(TC_selftest()); |
| } |
| }; |