| /////////////////////////////////////////////////////////////////////////////// |
| // Copyright (c) 2000-2019 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_CLL_Buffer_Test_Testcases |
| // |
| // Purpose: |
| // This module contains the testcases of EPTF Buffer feature |
| // |
| // Module depends on: |
| // <EPTF_CLL_Buffer_Definitions> |
| // <EPTF_CLL_Buffer_Functions> |
| // <EPTF_CLL_Base_Functions> |
| // |
| // |
| // Current Owner: |
| // Jozsef Gyurusi (ethjgi) |
| // |
| // Last Review Date: |
| // 2010-xx-xx |
| // |
| // Detailed Comments: |
| // - |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_CLL_Buffer_Test_Testcases { |
| |
| import from EPTF_CLL_Buffer_Definitions all; |
| import from EPTF_CLL_Buffer_Functions all; |
| import from EPTF_CLL_Base_Functions all; |
| |
| type component Main_CT extends EPTF_Buffer_CT{ |
| } |
| |
| function f_EPTF_Buffer_Test_testBuffer(in integer pl_bufferId) { |
| f_EPTF_Buffer_put_os(pl_bufferId,'AABBCC'O); |
| var octetstring vl_bufferData; |
| |
| f_EPTF_Buffer_get_read_data(pl_bufferId, vl_bufferData); |
| if (vl_bufferData!='AABBCC'O) { |
| setverdict(fail, "Unexpected bufferdata: ",vl_bufferData," expected: 'AABBCC'O"); |
| stop; |
| } |
| |
| f_EPTF_Buffer_set_pos(pl_bufferId,1); |
| if (f_EPTF_Buffer_get_pos(pl_bufferId)!=1) { |
| setverdict(fail, "Unexpected pos. Expected: 1"); |
| stop; |
| } |
| if (f_EPTF_Buffer_get_len(pl_bufferId)!=3) { |
| setverdict(fail, "Unexpected len: ",f_EPTF_Buffer_get_len(pl_bufferId),". Expected: 3"); |
| stop; |
| } |
| if (f_EPTF_Buffer_get_read_len(pl_bufferId)!=2) { |
| setverdict(fail, "Unexpected read len. Expected: 2"); |
| stop; |
| } |
| f_EPTF_Buffer_get_read_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='BBCC'O) { |
| setverdict(fail, "Unexpected buffer read data: ",vl_bufferData," expected: 'BBCC'O"); |
| stop; |
| } |
| f_EPTF_Buffer_get_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='AABBCC'O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: 'AABBCC'O"); |
| stop; |
| } |
| |
| |
| f_EPTF_Buffer_rewind(pl_bufferId); |
| if (f_EPTF_Buffer_get_pos(pl_bufferId)!=0) { |
| setverdict(fail, "Unexpected pos. Expected: 0"); |
| stop; |
| } |
| f_EPTF_Buffer_get_read_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='AABBCC'O) { |
| setverdict(fail, "Unexpected bufferdata: ",vl_bufferData," expected: 'AABBCC'O"); |
| stop; |
| } |
| |
| f_EPTF_Buffer_set_pos(pl_bufferId,2); |
| if (f_EPTF_Buffer_get_len(pl_bufferId)!=3) { |
| setverdict(fail, "Unexpected len: ",f_EPTF_Buffer_get_len(pl_bufferId),". Expected: 3"); |
| stop; |
| } |
| if (f_EPTF_Buffer_get_read_len(pl_bufferId)!=1) { |
| setverdict(fail, "Unexpected read len. Expected: 1"); |
| stop; |
| } |
| f_EPTF_Buffer_get_read_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='CC'O) { |
| setverdict(fail, "Unexpected buffer read data: ",vl_bufferData," expected: 'CC'O"); |
| stop; |
| } |
| f_EPTF_Buffer_get_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='AABBCC'O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: 'AABBCC'O"); |
| stop; |
| } |
| |
| |
| f_EPTF_Buffer_put_os(pl_bufferId,'DDEEFF'O); |
| if (f_EPTF_Buffer_get_len(pl_bufferId)!=6) { |
| setverdict(fail, "Unexpected len: ",f_EPTF_Buffer_get_len(pl_bufferId),". Expected: 6"); |
| stop; |
| } |
| if (f_EPTF_Buffer_get_read_len(pl_bufferId)!=4) { |
| setverdict(fail, "Unexpected read len. Expected: 4"); |
| stop; |
| } |
| f_EPTF_Buffer_get_read_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='CCDDEEFF'O) { |
| setverdict(fail, "Unexpected buffer read data: ",vl_bufferData," expected: 'CCDDEEFF'O"); |
| stop; |
| } |
| f_EPTF_Buffer_get_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='AABBCCDDEEFF'O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: 'AABBCCDDEEFF'O"); |
| stop; |
| } |
| |
| f_EPTF_Buffer_getReadDataFromOffset(pl_bufferId,3,vl_bufferData); |
| if (vl_bufferData!='DDEEFF'O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: 'DDEEFF'O"); |
| stop; |
| } |
| |
| f_EPTF_Buffer_getDataFromOffset(pl_bufferId,1,4,vl_bufferData); |
| if (vl_bufferData!='BBCCDDEE'O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: 'BBCCDDEE'O"); |
| stop; |
| } |
| |
| f_EPTF_Buffer_getDataFromOffset(pl_bufferId,3,4,vl_bufferData); |
| if (vl_bufferData!='DDEEFF'O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: 'DDEEFF'O"); |
| stop; |
| } |
| |
| f_EPTF_Buffer_cut(pl_bufferId); |
| if (f_EPTF_Buffer_get_len(pl_bufferId)!=4) { |
| setverdict(fail, "Unexpected len: ",f_EPTF_Buffer_get_len(pl_bufferId),". Expected: 4"); |
| stop; |
| } |
| if (f_EPTF_Buffer_get_read_len(pl_bufferId)!=4) { |
| setverdict(fail, "Unexpected read len. Expected: 4"); |
| stop; |
| } |
| f_EPTF_Buffer_get_read_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='CCDDEEFF'O) { |
| setverdict(fail, "Unexpected buffer read data: ",vl_bufferData," expected: 'CCDDEEFF'O"); |
| stop; |
| } |
| f_EPTF_Buffer_get_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='CCDDEEFF'O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: 'CCDDEEFF'O"); |
| stop; |
| } |
| |
| f_EPTF_Buffer_set_pos(pl_bufferId,2); |
| f_EPTF_Buffer_cut_end(pl_bufferId); |
| if (f_EPTF_Buffer_get_len(pl_bufferId)!=2) { |
| setverdict(fail, "Unexpected len: ",f_EPTF_Buffer_get_len(pl_bufferId),". Expected: 2"); |
| stop; |
| } |
| if (f_EPTF_Buffer_get_read_len(pl_bufferId)!=0) { |
| setverdict(fail, "Unexpected read len. Expected: 0"); |
| stop; |
| } |
| f_EPTF_Buffer_get_read_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!=''O) { |
| setverdict(fail, "Unexpected buffer read data: ",vl_bufferData," expected: ''O"); |
| stop; |
| } |
| f_EPTF_Buffer_get_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!='CCDD'O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: 'CCDD'O"); |
| stop; |
| } |
| |
| f_EPTF_Buffer_clear(pl_bufferId); |
| if (f_EPTF_Buffer_get_len(pl_bufferId)!=0) { |
| setverdict(fail, "Unexpected len: ",f_EPTF_Buffer_get_len(pl_bufferId),". Expected: 0"); |
| stop; |
| } |
| if (f_EPTF_Buffer_get_read_len(pl_bufferId)!=0) { |
| setverdict(fail, "Unexpected read len. Expected: 0"); |
| stop; |
| } |
| f_EPTF_Buffer_get_read_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!=''O) { |
| setverdict(fail, "Unexpected buffer read data: ",vl_bufferData," expected: ''O"); |
| stop; |
| } |
| f_EPTF_Buffer_get_data(pl_bufferId,vl_bufferData); |
| if (vl_bufferData!=''O) { |
| setverdict(fail, "Unexpected buffer data: ",vl_bufferData," expected: ''O"); |
| stop; |
| } |
| |
| } |
| |
| testcase tc_EPTF_Buffer_Test_main() runs on Main_CT { |
| f_EPTF_Buffer_init_CT("Buffer_TEST"); |
| |
| var integer vl_bufferId1 := f_EPTF_Buffer_new(); |
| var integer vl_bufferId2 := f_EPTF_Buffer_new(); |
| |
| f_EPTF_Buffer_Test_testBuffer(vl_bufferId1); |
| f_EPTF_Buffer_Test_testBuffer(vl_bufferId2); |
| |
| if (-1!=f_EPTF_Buffer_get_read_len(3222)) { |
| setverdict(fail, "Nonexistent buffer has lenght: ",f_EPTF_Buffer_get_read_len(3222)," expected: -1"); |
| stop; |
| } |
| |
| f_EPTF_Base_stop(pass); |
| |
| } |
| |
| testcase tc_EPTF_Buffer_Test_main2() runs on Main_CT { |
| f_EPTF_Buffer_init_CT("Buffer_TEST"); |
| |
| var integer vl_bufferId1 := f_EPTF_Buffer_new(); |
| var integer vl_bufferId2 := f_EPTF_Buffer_new(); |
| |
| f_EPTF_Buffer_Test_testBuffer(vl_bufferId1); |
| f_EPTF_Buffer_Test_testBuffer(vl_bufferId2); |
| |
| f_EPTF_Base_stop(pass); |
| |
| } |
| |
| control { |
| execute(tc_EPTF_Buffer_Test_main()); |
| execute(tc_EPTF_Buffer_Test_main2()); |
| } |
| } //module EPTF_CLL_Buffer_Test_Testcases |