| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2018 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 // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // |
| // Purpose: |
| // This module provides functions for testing R14 functionalities and bugfixes |
| // of LGenBase |
| // |
| // Module depends on: |
| // - |
| // |
| // Current Owner: |
| // Jozsef Gyurusi (ethjgi) |
| // |
| // Last Review Date: |
| // - |
| // |
| /////////////////////////////////////////////////////////////// |
| module EPTF_LGenBase_Test_TestcasesR14 |
| // [.objid{ itu_t(0) identified_organization(4) etsi(0) |
| // identified_organization(127) ericsson(5) testing(0) |
| // <put further nodes here if needed>}] |
| { |
| import from EPTF_LGenBase_Test_Definitions all; |
| import from EPTF_CLL_Common_Definitions all; |
| import from EPTF_CLL_LGenBase_Functions all; |
| import from EPTF_CLL_LGenBase_TrafficFunctions all; |
| import from EPTF_CLL_LGenBase_ConfigDefinitions all; |
| import from EPTF_CLL_LGenBase_ConfigFunctions all; |
| import from EPTF_LGenBase_Test_TestcasesR3 all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_LGenBase_Definitions all; |
| |
| group AppDataItemOfEntityCtx_test { |
| |
| function f_LGenBase_getAppDataItemOfEntityCtx_init() runs on EPTF_LGenBase_VarAndStatTest_CT { |
| f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| f_EPTF_LGenBase_declareBehaviorType("b2", -1, null, null, null); |
| f_EPTF_LGenBase_declareBehaviorType("b3", -1, null, null, null); |
| f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| f_EPTF_LGenBase_declareEntityType("et2", {"b2"}); |
| f_EPTF_LGenBase_declareEntityType("et3", {"b3"}); |
| f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 10}); |
| f_EPTF_LGenBase_createEntityGroup({"eg2", "et1", 20}); |
| f_EPTF_LGenBase_createEntityGroup({"eg3", "et1", 30}); |
| f_EPTF_LGenBase_declareFSMTable({ |
| name := "FSM1", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := {{ |
| { |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, |
| omit, omit |
| }} |
| } |
| } |
| } |
| }); |
| f_EPTF_LGenBase_declareFSMTable({ |
| name := "FSM2", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := {{ |
| { |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, |
| omit, omit |
| }} |
| } |
| } |
| } |
| }); |
| f_EPTF_LGenBase_declareFSMTable({ |
| name := "FSM3", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {c_EPTF_LGenBase_behavior,c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := {{ |
| { |
| {c_EPTF_LGenBase_stepName_trafficSuccess, omit} |
| }, |
| omit, omit |
| }} |
| } |
| } |
| } |
| }); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_getAppDataItemOfEntityCtx_test |
| // |
| // Purpose: Tests the f_EPTF_LGenBase_getAppDataItemOfEntityCtx function by requesting an already set app-data. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataItemOfEntityCtx is called. |
| // After that the data is requested by f_EPTF_LGenBase_getAppDataItemOfEntityCtx and the result is checked |
| // against the original. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_getAppDataItemOfEntityCtx_test() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataItemOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| |
| var integer vl_expectedValue := 1; |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 1, |
| pl_bIdx := 1, |
| pl_itemIdx := 1, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_itemIdx := 0, |
| pl_itemValue := 0 |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_itemIdx := 2, |
| pl_itemValue := 2 |
| ); |
| |
| var integer vl_value := f_EPTF_LGenBase_getAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 1, |
| pl_bIdx := 1, |
| pl_itemIdx := 1 |
| ); |
| if( vl_expectedValue != vl_value) { |
| setverdict(fail,"Expected value of f_EPTF_LGenBase_getAppDataItemOfEntityCtx ", vl_expectedValue," differs from actual: ", vl_value); |
| } else { |
| setverdict(pass); |
| }; |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidEntityAbsIndex |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_getAppDataItemOfEntityCtx function. Requesting an app-data for invalid entity abs index. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataItemOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_getAppDataItemOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidEntityAbsIndex() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataItemOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_getAppDataItemOfEntityCtx: invalid entity abs. index:60"); |
| |
| var integer vl_expectedValue := 1; |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_itemIdx := 0, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_itemIdx := 2, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| var integer vl_value := f_EPTF_LGenBase_getAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 60, // invalid |
| pl_bIdx := 2, |
| pl_itemIdx := 1 |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidBehaviourTypeIndex |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_getAppDataItemOfEntityCtx function. Requesting an app-data for invalid behavior type index. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataItemOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_getAppDataItemOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidBehaviourTypeIndex() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataItemOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_getAppDataItemOfEntityCtx: invalid behavior type index:4"); |
| |
| var integer vl_expectedValue := 1; |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_itemIdx := 0, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_itemIdx := 2, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| var integer vl_value := f_EPTF_LGenBase_getAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 59, // valid |
| pl_bIdx := 4, // invalid |
| pl_itemIdx := 1 |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_nonexistentAppData |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_getAppDataItemOfEntityCtx function. Requesting an app-data for invalid behavior type index for appdata. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataItemOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_getAppDataItemOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_nonexistentAppData() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataItemOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_getAppDataItemOfEntityCtx: behavior type index for appdata is non-existent:1 for entity 1"); |
| |
| var integer vl_expectedValue := 1; |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_itemIdx := 0, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_itemIdx := 2, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| var integer vl_value := f_EPTF_LGenBase_getAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 1, // valid |
| pl_bIdx := 1, // valid, but updata missing |
| pl_itemIdx := 0 |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidAppDataItem |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_getAppDataItemOfEntityCtx function. Requesting an app-data for invalid behavior type index for appdata. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataItemOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_getAppDataItemOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidAppDataItem() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataItemOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_getAppDataItemOfEntityCtx: invalid appdata item index:0 for behavior type index 1 for entity 1"); |
| |
| var integer vl_expectedValue := 1; |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 1, |
| pl_bIdx := 1, |
| pl_itemIdx := 1, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_itemIdx := 0, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_itemIdx := 2, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| var integer vl_value := f_EPTF_LGenBase_getAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 1, // valid |
| pl_bIdx := 1, // valid |
| pl_itemIdx := 0 // invalid |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidEntityAbsIndex |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_setAppDataItemOfEntityCtx function. Requesting an app-data for invalid entity abs index. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataItemOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_setAppDataItemOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidEntityAbsIndex() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("setAppDataItemOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_setAppDataItemOfEntityCtx: invalid entity abs. index:60"); |
| |
| var integer vl_expectedValue := 1; |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_itemIdx := 0, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_itemIdx := 2, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 60, // invalid |
| pl_bIdx := 2, |
| pl_itemIdx := 1, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidBehaviourTypeIndex |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_setAppDataItemOfEntityCtx function. Requesting an app-data for invalid behavior type index. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataItemOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_setAppDataItemOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidBehaviourTypeIndex() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("setAppDataItemOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_setAppDataItemOfEntityCtx: invalid behavior type index:4"); |
| |
| var integer vl_expectedValue := 1; |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_itemIdx := 0, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_itemIdx := 2, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 59, // valid |
| pl_bIdx := 4, // invalid |
| pl_itemIdx := 1, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidAppDataItem |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_setAppDataItemOfEntityCtx function. Requesting an app-data for invalid behavior type index for appdata. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataItemOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_setAppDataItemOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidAppDataItem() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("setAppDataItemOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_setAppDataItemOfEntityCtx: invalid appdata item index:-1 for behavior type index 1 for entity 1"); |
| |
| var integer vl_expectedValue := 1; |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 1, |
| pl_bIdx := 1, |
| pl_itemIdx := 1, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_itemIdx := 0, |
| pl_itemValue := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_itemIdx := 2, |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| f_EPTF_LGenBase_setAppDataItemOfEntityCtx( |
| pl_eAbsIdx := 1, // valid |
| pl_bIdx := 1, // valid |
| pl_itemIdx := -1, // invalid |
| pl_itemValue := vl_expectedValue |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| |
| } // group AppDataItemOfEntityCtx_test |
| |
| |
| group AppDataListOfEntityCtx_test { |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_getAppDataListOfEntityCtx_test |
| // |
| // Purpose: Tests the f_EPTF_LGenBase_getAppDataListOfEntityCtx function by requesting an already set app-data. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataListOfEntityCtx is called. |
| // After that the data is requested by f_EPTF_LGenBase_getAppDataListOfEntityCtx and the result is checked |
| // against the original. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_getAppDataListOfEntityCtx_test() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataListOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| |
| var EPTF_IntegerList vl_expectedValue := {-,1}; |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 1, |
| pl_bIdx := 1, |
| pl_list := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_list := {} |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_list := {[2] := 2} |
| ); |
| |
| var EPTF_IntegerList vl_value; |
| f_EPTF_LGenBase_getAppDataListOfEntityCtx( |
| pl_eAbsIdx := 1, |
| pl_bIdx := 1, |
| pl_list := vl_value |
| ); |
| if( vl_expectedValue != vl_value) { |
| setverdict(fail,"Expected value of f_EPTF_LGenBase_getAppDataListOfEntityCtx ", vl_expectedValue," differs from actual: ", vl_value); |
| } else { |
| setverdict(pass); |
| }; |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_getAppDataListOfEntityCtx_test_InvalidEntityAbsIndex |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_getAppDataListOfEntityCtx function. Requesting an app-data for invalid entity abs index. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataListOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_getAppDataListOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_getAppDataListOfEntityCtx_test_InvalidEntityAbsIndex() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataListOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_getAppDataListOfEntityCtx: invalid entity abs. index:60"); |
| |
| var EPTF_IntegerList vl_expectedValue := {-,1}; |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_list := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_list := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| var EPTF_IntegerList vl_value; |
| f_EPTF_LGenBase_getAppDataListOfEntityCtx( |
| pl_eAbsIdx := 60, // invalid |
| pl_bIdx := 2, |
| pl_list := vl_value |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_getAppDataListOfEntityCtx_test_InvalidBehaviourTypeIndex |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_getAppDataListOfEntityCtx function. Requesting an app-data for invalid behavior type index. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataListOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_getAppDataListOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_getAppDataListOfEntityCtx_test_InvalidBehaviourTypeIndex() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataListOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_getAppDataListOfEntityCtx: invalid behavior type index:4"); |
| |
| var EPTF_IntegerList vl_expectedValue := {-,1}; |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_list := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_list := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| var EPTF_IntegerList vl_value; |
| f_EPTF_LGenBase_getAppDataListOfEntityCtx( |
| pl_eAbsIdx := 59, // valid |
| pl_bIdx := 4, // invalid |
| pl_list := vl_value |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_getAppDataListOfEntityCtx_test_nonexistentAppData |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_getAppDataListOfEntityCtx function. Requesting an app-data for invalid behavior type index for appdata. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataListOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_getAppDataListOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_getAppDataListOfEntityCtx_test_nonexistentAppData() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataListOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| |
| var EPTF_IntegerList vl_expectedValue := {-,1}; |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_list := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_list := vl_expectedValue |
| ); |
| |
| // appdata does not exist, but function retuns empty list: |
| var EPTF_IntegerList vl_value; |
| f_EPTF_LGenBase_getAppDataListOfEntityCtx( |
| pl_eAbsIdx := 1, // valid |
| pl_bIdx := 1, // valid, but updata missing |
| pl_list := vl_value |
| ); |
| |
| if (vl_value != {}) { |
| setverdict(fail, "Invalid value for non-existent appdata. Should be {}"); |
| } else { |
| setverdict(pass); |
| } |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_getAppDataListOfEntityCtx_test_InvalidAppDataList |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_getAppDataListOfEntityCtx function. Requesting an app-data for invalid behavior type index for appdata. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataListOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_getAppDataListOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_getAppDataListOfEntityCtx_test_InvalidAppDataList() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getAppDataListOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| |
| var EPTF_IntegerList vl_expectedValue := {-,1}; |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 1, |
| pl_bIdx := 1, |
| pl_list := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_list := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_list := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| var EPTF_IntegerList vl_value; |
| f_EPTF_LGenBase_getAppDataListOfEntityCtx( |
| pl_eAbsIdx := 1, // valid |
| pl_bIdx := 1, // valid |
| pl_list := vl_value |
| ); |
| |
| if (vl_value != vl_expectedValue) { |
| setverdict(fail, "Invalid value for appdata. Should be ",vl_expectedValue, " but got: ",vl_value); |
| } else { |
| setverdict(pass); |
| } |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_setAppDataListOfEntityCtx_test_InvalidEntityAbsIndex |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_setAppDataListOfEntityCtx function. Requesting an app-data for invalid entity abs index. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataListOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_setAppDataListOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_setAppDataListOfEntityCtx_test_InvalidEntityAbsIndex() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("setAppDataListOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_setAppDataListOfEntityCtx: invalid entity abs. index:60"); |
| |
| var EPTF_IntegerList vl_expectedValue := {-,1}; |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_list := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_list := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 60, // invalid |
| pl_bIdx := 2, |
| pl_list := vl_expectedValue |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Neg_setAppDataListOfEntityCtx_test_InvalidBehaviourTypeIndex |
| // |
| // Purpose: Negative test of the f_EPTF_LGenBase_setAppDataListOfEntityCtx function. Requesting an app-data for invalid behavior type index. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the necessary configuration is declared, the f_EPTF_LGenBase_setAppDataListOfEntityCtx is called. |
| // After that the data is requested for an nonexistent appdata by f_EPTF_LGenBase_setAppDataListOfEntityCtx. |
| // The resulting error is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| testcase tc_LGenBase_Neg_setAppDataListOfEntityCtx_test_InvalidBehaviourTypeIndex() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("setAppDataListOfEntityCtx"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| f_EPTF_Base_setExpectedAssertMsg("f_EPTF_LGenBase_setAppDataListOfEntityCtx: invalid behavior type index:4"); |
| |
| var EPTF_IntegerList vl_expectedValue := {-,1}; |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 0, |
| pl_bIdx := 0, |
| pl_list := vl_expectedValue |
| ); |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 2, |
| pl_bIdx := 2, |
| pl_list := vl_expectedValue |
| ); |
| |
| // this line should cause an assert: |
| f_EPTF_LGenBase_setAppDataListOfEntityCtx( |
| pl_eAbsIdx := 59, // valid |
| pl_bIdx := 4, // invalid |
| pl_list := vl_expectedValue |
| ); |
| |
| f_EPTF_Base_cleanup_CT() |
| } |
| |
| } // group AppDataListOfEntityCtx_test |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_getNrOfTCs_test |
| // |
| // Purpose: Test of the f_EPTF_LGenBase_getNrOfTCs function. The tested function should return the number of TCs created, in this case this value is 10. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the configuration is declared, which contains two scenarios: SC1 with two TCs and SC2 with three TCs.Both SCs were mapped twice to entity groups. |
| // After that the tc_LGenBase_getNrOfTCs_test() function is called. |
| // The resulting value of the function is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_getNrOfTCs_test() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getNrOfTCs"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM1", |
| "FSM2" |
| } |
| } |
| } |
| }, |
| {"TC2",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM1", |
| "FSM3" |
| } |
| } |
| } |
| } |
| }, |
| {} |
| }) |
| |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC2", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM1", |
| "FSM2" |
| } |
| } |
| } |
| }, |
| {"TC2",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM1" |
| } |
| } |
| } |
| }, |
| {"TC3",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM2", |
| "FSM3" |
| } |
| } |
| } |
| } |
| }, |
| {} |
| }) |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg2","SC1"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg2","SC2"},false); |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg3","SC2"},false); |
| |
| var integer vl_expectedValue := 10; |
| var integer vl_TCsNr := f_EPTF_LGenBase_getNrOfTCs(); |
| |
| if(vl_TCsNr != vl_expectedValue) { |
| setverdict ( fail, "Invalid value for number of TCs. Should be ",vl_expectedValue, " but got: ",vl_TCsNr ); |
| } else { |
| setverdict ( pass ); |
| } |
| |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_getNrOfTCs_test_NoTCs |
| // |
| // Purpose: Test of the f_EPTF_LGenBase_getNrOfTCs function. The tested function should return the number of TCs created, in this case this value is 0. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the configuration is declared, which does not contain any scenarios. |
| // After that the tc_LGenBase_getNrOfTCs_test() function is called. |
| // The resulting value of the function is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_getNrOfTCs_test_NoTCs() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getNrOfTCs"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| |
| var integer vl_expectedValue := 0; |
| var integer vl_TCsNr := f_EPTF_LGenBase_getNrOfTCs(); |
| |
| if(vl_TCsNr != vl_expectedValue) { |
| setverdict ( fail, "Invalid value for number of TCs. Should be ",vl_expectedValue, " but got: ",vl_TCsNr ); |
| } else { |
| setverdict ( pass ); |
| } |
| |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_getNrOfTCs_test_NoSC2GroupMapping |
| // |
| // Purpose: Test of the f_EPTF_LGenBase_getNrOfTCs function. The tested function should return the number of TCs created, in this case this value is 0. |
| // The verdict of the test case should be pass. |
| // |
| // Action: After the configuration is declared, which contains two scenarios: SC1 with two TCs and SC2 with three TCs.The SCs are not mapped to any entity groups. |
| // After that the tc_LGenBase_getNrOfTCs_test() function is called. |
| // The resulting value of the function is checked against the expected. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_getNrOfTCs_test_NoSC2GroupMapping() runs on EPTF_LGenBase_VarAndStatTest_CT{ |
| |
| f_EPTF_LGenBase_init("getNrOfTCs"); |
| f_LGenBase_getAppDataItemOfEntityCtx_init(); |
| |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM1", |
| "FSM2" |
| } |
| } |
| } |
| }, |
| {"TC2",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM1", |
| "FSM3" |
| } |
| } |
| } |
| } |
| }, |
| {} |
| }) |
| |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC2", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM1", |
| "FSM2" |
| } |
| } |
| } |
| }, |
| {"TC2",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM1" |
| } |
| } |
| } |
| }, |
| {"TC3",{ |
| {target := {cpsToReach := 0.0}}, |
| {fsmList := |
| { |
| "FSM2", |
| "FSM3" |
| } |
| } |
| } |
| } |
| }, |
| {} |
| }) |
| |
| var integer vl_expectedValue := 0; |
| var integer vl_TCsNr := f_EPTF_LGenBase_getNrOfTCs(); |
| |
| if(vl_TCsNr != vl_expectedValue) { |
| setverdict ( fail, "Invalid value for number of TCs. Should be ",vl_expectedValue, " but got: ",vl_TCsNr ); |
| } else { |
| setverdict ( pass ); |
| } |
| |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_declareFsmEventList_test |
| // |
| // Purpose: Test of the f_EPTF_LGenBase_declareFsmEventList function. The tested function should create the events listed in the input array of the function, without |
| // any errors. |
| // |
| // Action: After the configuration is declared, the event array is generated with 10 events, from event0 to event9 and the event constants from 0 to 9 for each event. |
| // The next step of the testcase invokes the f_EPTF_LGenBase_declareBehaviorType() function to create the events from the array. The testcase checks that the |
| // index of the generated events matches the constant of the event, or not. If all the value pairs matched, the verdict of the testcase is set to pass. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_declareFsmEventList_test() runs on EPTF_LGenBase_VarAndStatTest_CT { |
| |
| const charstring cl_EPTF_LGenBase_behaviourName := "testBehaviour"; |
| var integer vl_index := -2; |
| var EPTF_LGenBase_EventArrayDeclaratorList vl_eventArray := {}; |
| |
| f_EPTF_LGenBase_init("declareFsmEventList"); |
| |
| for(var integer vl_i :=0; vl_i < 10; vl_i := vl_i +1){ |
| |
| vl_eventArray[vl_i].eventConstant := vl_i; |
| vl_eventArray[vl_i].eventName := "event"&int2str(vl_i); |
| |
| } |
| |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType(cl_EPTF_LGenBase_behaviourName, 0, null, null, null); |
| |
| f_EPTF_LGenBase_declareFsmEventList(vl_eventArray, cl_EPTF_LGenBase_behaviourName); |
| |
| for(var integer vl_j := 0; vl_j < 10; vl_j := vl_j +1){ |
| |
| vl_index := f_EPTF_LGenBase_inputNameIndex(cl_EPTF_LGenBase_behaviourName, vl_eventArray[vl_j].eventName); |
| |
| if(vl_index != vl_eventArray[vl_j].eventConstant){ |
| |
| setverdict ( fail, "Invalid value for event index. Should be: ",vl_eventArray[vl_j].eventConstant, " but got: ",vl_index ); |
| |
| |
| } else { |
| |
| setverdict ( pass ); |
| |
| |
| } |
| |
| } |
| |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_declareFsmEventList_test_NoInput |
| // |
| // Purpose: Test of the f_EPTF_LGenBase_declareFsmEventList function. The tested function should create the events listed in the input array of the function, without |
| // any errors. |
| // |
| // Action: After the configuration is declared, an empty event array is generated. The next step of the testcase invokes the f_EPTF_LGenBase_declareBehaviorType() function. |
| // The verdict of the testcase is set to pass, if no errors occur, during the invocation of the f_EPTF_LGenBase_declareBehaviorType() function. |
| // |
| // Expected Result: pass verdict. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_declareFsmEventList_test_NoInput() runs on EPTF_LGenBase_VarAndStatTest_CT { |
| |
| const charstring cl_EPTF_LGenBase_behaviourName := "testBehaviour"; |
| var EPTF_LGenBase_EventArrayDeclaratorList vl_eventArray := {}; |
| |
| f_EPTF_LGenBase_init("declareFsmEventList"); |
| |
| for(var integer vl_i :=0; vl_i < 10; vl_i := vl_i +1){ |
| |
| vl_eventArray[vl_i].eventConstant := vl_i; |
| vl_eventArray[vl_i].eventName := "event"&int2str(vl_i); |
| |
| } |
| |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType(cl_EPTF_LGenBase_behaviourName, 0, null, null, null); |
| |
| f_EPTF_LGenBase_declareFsmEventList(vl_eventArray, cl_EPTF_LGenBase_behaviourName); |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_declareFsmEventList_test_Negative_existingEvent |
| // |
| // Purpose: Test of the f_EPTF_LGenBase_declareFsmEventList function with a duplicated event in the input list. The tested function should create the events listed in |
| // the input array of the function, with an "event has already benn defined" error. |
| // |
| // Action: After the configuration is declared, the event array is generated with 11 events, from event0 to event9 and the event constants from 0 to 9 for each event |
| // and event2 is duplicated. The next step of the testcase invokes the f_EPTF_LGenBase_declareBehaviorType() function to create the events from the array. |
| // |
| // Expected Result: pass verdict. The expected error message is set to "*The event "&cl_EPTF_LGenBase_existingEvent&" of behavior "&cl_EPTF_LGenBase_behaviourName&" has already been defined!". |
| // If the expected error message occurs, the verdict of the testcase is set to pass. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_declareFsmEventList_test_Negative_existingEvent() runs on EPTF_LGenBase_VarAndStatTest_CT { |
| |
| const charstring cl_EPTF_LGenBase_behaviourName := "testBehaviour"; |
| const integer cl_EPTF_LGenBase_existingEventConst := 2; |
| const charstring cl_EPTF_LGenBase_existingEvent := "event"&int2str(cl_EPTF_LGenBase_existingEventConst); |
| var integer vl_i := 10; |
| var EPTF_LGenBase_EventArrayDeclaratorList vl_eventArray := {}; |
| |
| f_EPTF_LGenBase_init("declareFsmEventList"); |
| f_EPTF_Base_setExpectedErrorMsg("*The event "&cl_EPTF_LGenBase_existingEvent&" of behavior "&cl_EPTF_LGenBase_behaviourName&" has already been defined!"); |
| |
| for( vl_i :=0; vl_i < 10; vl_i := vl_i +1){ |
| |
| vl_eventArray[vl_i].eventConstant := vl_i; |
| vl_eventArray[vl_i].eventName := "event"&int2str(vl_i); |
| |
| } |
| |
| vl_eventArray[vl_i].eventConstant := cl_EPTF_LGenBase_existingEventConst; |
| vl_eventArray[vl_i].eventName := cl_EPTF_LGenBase_existingEvent; |
| |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType(cl_EPTF_LGenBase_behaviourName, 0, null, null, null); |
| |
| f_EPTF_LGenBase_declareFsmEventList(vl_eventArray, cl_EPTF_LGenBase_behaviourName); |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_declareFsmEventList_test_Negative_invalidBehaviour |
| // |
| // Purpose: Test of the f_EPTF_LGenBase_declareFsmEventList function with a duplicated event in the input list. The tested function should create the events listed in |
| // the input array of the function, with an "invalid behaviour type" error. |
| // |
| // Action: After the configuration is declared, the event array is generated with 10 events, from event0 to event9 and the event constants from 0 to 9 for each event. |
| // The next step of the testcase invokes the f_EPTF_LGenBase_declareBehaviorType() function to create the events from the array but the function has an invalid behaviour type as input. |
| // |
| // Expected Result: pass verdict. The expected error message is set to "*Invalid behavior type: "&cl_EPTF_LGenBase_invalidBehaviourName. If the expected error message occurs, |
| // the verdict of the testcase is set to pass. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_declareFsmEventList_test_Negative_invalidBehaviour() runs on EPTF_LGenBase_VarAndStatTest_CT { |
| |
| const charstring cl_EPTF_LGenBase_behaviourName := "testBehaviour"; |
| const charstring cl_EPTF_LGenBase_invalidBehaviourName := "invalidTestBehaviour"; |
| var integer vl_i := 10; |
| var EPTF_LGenBase_EventArrayDeclaratorList vl_eventArray := {}; |
| |
| f_EPTF_LGenBase_init("declareFsmEventList"); |
| f_EPTF_Base_setExpectedErrorMsg("*Invalid behavior type: "&cl_EPTF_LGenBase_invalidBehaviourName); |
| |
| for( vl_i :=0; vl_i < 10; vl_i := vl_i +1){ |
| |
| vl_eventArray[vl_i].eventConstant := vl_i; |
| vl_eventArray[vl_i].eventName := "event"&int2str(vl_i); |
| |
| } |
| |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType(cl_EPTF_LGenBase_behaviourName, 0, null, null, null); |
| |
| f_EPTF_LGenBase_declareFsmEventList(vl_eventArray, cl_EPTF_LGenBase_invalidBehaviourName); |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_declareFsmEventList_test_Negative_invalidIndex |
| // |
| // Purpose: Test of the f_EPTF_LGenBase_declareFsmEventList function with a duplicated event in the input list. The tested function should create the events listed in |
| // the input array of the function, with an "invalid behaviour type" error. |
| // |
| // Action: After the configuration is declared, the event array is generated with 10 events, from event0 to event9 and the event constants from 0 to 9 |
| // for each event. After this step, the index of event3 is changed to its double value.The next step of the testcase invokes the f_EPTF_LGenBase_declareBehaviorType() |
| // function to create the events from the array but the event3 has an invalid index value. |
| // |
| // Expected Result: pass verdict. The expected error message is set to "*"&cl_EPTF_LGenBase_invalidEvent&" must be "&int2str(cl_EPTF_LGenBase_invalidIndex). If the expected error message occurs, |
| // the verdict of the testcase is set to pass. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_declareFsmEventList_test_Negative_invalidIndex() runs on EPTF_LGenBase_VarAndStatTest_CT { |
| |
| const charstring cl_EPTF_LGenBase_behaviourName := "testBehaviour"; |
| const integer cl_EPTF_LGenBase_invalidEventIndex := 3; |
| const integer cl_EPTF_LGenBase_invalidIndex := cl_EPTF_LGenBase_invalidEventIndex*2; |
| const charstring cl_EPTF_LGenBase_invalidEvent := "event"&int2str(cl_EPTF_LGenBase_invalidEventIndex); |
| var integer vl_i := 10; |
| var EPTF_LGenBase_EventArrayDeclaratorList vl_eventArray := {}; |
| |
| f_EPTF_LGenBase_init("declareFsmEventList"); |
| f_EPTF_Base_setExpectedAssertMsg("*"&cl_EPTF_LGenBase_invalidEvent&" must be "&int2str(cl_EPTF_LGenBase_invalidIndex)); |
| |
| for( vl_i :=0; vl_i < 10; vl_i := vl_i +1){ |
| |
| if(vl_i == cl_EPTF_LGenBase_invalidEventIndex){ |
| vl_eventArray[vl_i].eventConstant := cl_EPTF_LGenBase_invalidIndex; |
| } else { |
| |
| vl_eventArray[vl_i].eventConstant := vl_i; |
| |
| } |
| |
| vl_eventArray[vl_i].eventName := "event"&int2str(vl_i); |
| |
| } |
| |
| |
| |
| v_dummyInt := f_EPTF_LGenBase_declareBehaviorType(cl_EPTF_LGenBase_behaviourName, 0, null, null, null); |
| |
| f_EPTF_LGenBase_declareFsmEventList(vl_eventArray, cl_EPTF_LGenBase_behaviourName); |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_LGenBase_Manual_noMoreFreeSlotMsg |
| // |
| // Purpose: Test, if the "no more free slot" message appears or not. |
| // |
| // Expected Result: pass verdict. This is a manual test. |
| // The "no more free slot" message should not appear in consol nor in log files. |
| /////////////////////////////////////////////////////////// |
| |
| testcase tc_LGenBase_Manual_noMoreFreeSlotMsg() runs on EPTF_LGenBase_Test_CT{ |
| |
| f_EPTF_LGenBase_init("noFreeSlotMsg"); |
| |
| f_EPTF_LGenBase_declareBehaviorType("b1", -1, null, null, null); |
| f_EPTF_LGenBase_declareEntityType("et1", {"b1"}); |
| f_EPTF_LGenBase_createEntityGroup({"eg1", "et1", 10}); |
| v_dummyInt := f_EPTF_LGenBase_declareFsmEvent("b1",c_EPTF_LGenBase_inputName_testMgmt_startTC); |
| f_EPTF_LGenBase_declareFSMTable({ |
| name := "FSM1", |
| fsmParams := { |
| {stateList := {"idle"}} |
| }, |
| table := { |
| classicTable := { |
| {eventToListen := {"b1",c_EPTF_LGenBase_inputName_testMgmt_startTC,fsm}, |
| cellRow := {{ |
| { |
| {c_EPTF_LGenBase_stepName_log, { charstringValue := "test" }} |
| }, |
| omit, omit |
| }} |
| } |
| } |
| } |
| }); |
| |
| v_dummyInt := f_EPTF_LGenBase_declareScenarioType3( |
| { "SC1", |
| { |
| {"TC1",{ |
| {target := {cpsToReach := 10.0}}, |
| { enableEntitiesAtStart := true }, |
| { enabledAtStart := true }, |
| {fsmList := {"FSM1"}} |
| } |
| } |
| }, |
| {{enabled := true}} |
| }) |
| |
| |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","SC1"},true); |
| timer t_startTest := 5.0; |
| t_startTest.start; |
| t_startTest.timeout; |
| |
| f_EPTF_Base_stopAll(pass); |
| |
| } |
| |
| control{ |
| execute(tc_LGenBase_getAppDataItemOfEntityCtx_test()); |
| execute(tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidEntityAbsIndex()); |
| execute(tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidBehaviourTypeIndex()); |
| execute(tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_nonexistentAppData()); |
| execute(tc_LGenBase_Neg_getAppDataItemOfEntityCtx_test_InvalidAppDataItem()); |
| execute(tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidEntityAbsIndex()); |
| execute(tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidBehaviourTypeIndex()); |
| execute(tc_LGenBase_Neg_setAppDataItemOfEntityCtx_test_InvalidAppDataItem()); |
| execute(tc_LGenBase_getAppDataListOfEntityCtx_test()); |
| execute(tc_LGenBase_Neg_getAppDataListOfEntityCtx_test_InvalidEntityAbsIndex()); |
| execute(tc_LGenBase_Neg_getAppDataListOfEntityCtx_test_InvalidBehaviourTypeIndex()); |
| execute(tc_LGenBase_getAppDataListOfEntityCtx_test_nonexistentAppData()); |
| execute(tc_LGenBase_getAppDataListOfEntityCtx_test_InvalidAppDataList()); |
| execute(tc_LGenBase_Neg_setAppDataListOfEntityCtx_test_InvalidEntityAbsIndex()); |
| execute(tc_LGenBase_Neg_setAppDataListOfEntityCtx_test_InvalidBehaviourTypeIndex()); |
| execute(tc_LGenBase_getNrOfTCs_test()); |
| execute(tc_LGenBase_getNrOfTCs_test_NoTCs()); |
| execute(tc_LGenBase_getNrOfTCs_test_NoSC2GroupMapping()); |
| execute(tc_LGenBase_declareFsmEventList_test()); |
| execute(tc_LGenBase_declareFsmEventList_test_NoInput()); |
| execute(tc_LGenBase_declareFsmEventList_test_Negative_existingEvent()); |
| execute(tc_LGenBase_declareFsmEventList_test_Negative_invalidBehaviour()); |
| execute(tc_LGenBase_declareFsmEventList_test_Negative_invalidIndex()); |
| |
| } |
| |
| } // end of module |