| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2017 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: HashMap_global_test |
| // |
| // Purpose: |
| // Test file for HashMap. |
| // |
| ////////////////////////////////////////////////////////// |
| |
| module HashMap_global_test |
| |
| { |
| |
| //========================================================================= |
| // Import Part |
| //========================================================================= |
| |
| import from EPTF_CLL_HashMapStr2Int_Functions all; |
| import from EPTF_CLL_HashMapOct2Int_Functions all; |
| import from EPTF_CLL_HashMapInt2Int_Functions all; |
| import from TCCEnv_Functions all; |
| import from EPTF_CLL_HashMap_Functions all; |
| import from EPTF_CLL_HashMap_Definitions all; |
| import from EPTF_CLL_Base_Functions all; |
| |
| //========================================================================= |
| //Component Types |
| //========================================================================= |
| |
| type component MyMTC_CT extends EPTF_HashMap_CT{ |
| } |
| |
| |
| //========================================================================= |
| // Testcases |
| //========================================================================= |
| |
| testcase tc_HashMap_global_test() |
| runs on MyMTC_CT |
| { |
| f_EPTF_HashMap_init_CT ("HashMapTest"); |
| //creating hashmap countaining string keys |
| var charstring string_hashmap := "my_string_hashmap"; |
| var integer string_hashmap_id; |
| var integer string_id_check; |
| log("Creating hashmap countaining string keys called: ",string_hashmap); |
| string_hashmap_id := f_EPTF_str2int_HashMap_New (string_hashmap); |
| |
| |
| // getting the ID of hashmap |
| log("Getting the ID of string hashmap"); |
| if( f_EPTF_str2int_HashMap_GetID(string_hashmap,string_id_check) ) |
| { |
| if ( string_hashmap_id == string_id_check ){ setverdict(pass) } else { setverdict (fail) } |
| } |
| |
| //creating hashmap countaining octet keys |
| var charstring octet_hashmap := "my_octet_hashmap"; |
| var integer octet_hashmap_id; |
| var integer octet_id_check; |
| log("Creating hashmap countaining octet keys called: ",octet_hashmap); |
| octet_hashmap_id := f_EPTF_oct2int_HashMap_New (octet_hashmap); |
| |
| // getting the ID of hashmap |
| log("Getting the ID of octet hashmap"); |
| if( f_EPTF_oct2int_HashMap_GetID(octet_hashmap,octet_id_check) ) |
| { |
| if ( octet_hashmap_id == octet_id_check ){ setverdict(pass) } else { setverdict (fail) } |
| } |
| |
| //creating hashmap countaining integer keys |
| var charstring integer_hashmap := "my_integer_hashmap"; |
| var integer integer_hashmap_id; |
| var integer integer_id_check; |
| log("Creating hashmap countaining integer keys called: ",integer_hashmap); |
| integer_hashmap_id := f_EPTF_int2int_HashMap_New (integer_hashmap); |
| |
| // getting the ID of hashmap |
| log("Getting the ID of integer hashmap"); |
| if( f_EPTF_int2int_HashMap_GetID(integer_hashmap,integer_id_check) ) |
| { |
| if ( integer_hashmap_id == integer_id_check ){ setverdict(pass) } else { setverdict (fail) } |
| } |
| |
| //insert to second hashmap |
| log( "Inserting data to hashmaps" ); |
| f_EPTF_str2int_HashMap_Insert ( string_hashmap_id,"hello", 11 ); |
| f_EPTF_str2int_HashMap_Insert ( string_hashmap_id,"good", 33 ); |
| f_EPTF_oct2int_HashMap_Insert ( octet_hashmap_id, '5A'O, 11 ); |
| f_EPTF_oct2int_HashMap_Insert ( octet_hashmap_id, '6B10'O, 33 ); |
| f_EPTF_int2int_HashMap_Insert ( integer_hashmap_id,123 , 11 ); |
| f_EPTF_int2int_HashMap_Insert ( integer_hashmap_id,234 , 33 ); |
| |
| // Dumping all hashmap |
| f_EPTF_str2int_HashMap_DumpAll(); |
| f_EPTF_oct2int_HashMap_DumpAll(); |
| f_EPTF_int2int_HashMap_DumpAll(); |
| |
| |
| //deleting hashmaps |
| f_EPTF_str2int_HashMap_Delete (string_hashmap); |
| log("Deleting hashmap called: ",string_hashmap); |
| |
| f_EPTF_oct2int_HashMap_Delete (octet_hashmap); |
| log("Deleting hashmap called: ",octet_hashmap); |
| |
| f_EPTF_int2int_HashMap_Delete (integer_hashmap); |
| log("Deleting hashmap called: ",integer_hashmap); |
| |
| f_EPTF_Base_stop(none); |
| } |
| |
| //========================================================================= |
| // Control |
| //========================================================================= |
| |
| control |
| { |
| select (f_GetEnv("TTCN_TEST_TYPE")) { |
| case ("SMOKE") { |
| execute( tc_HashMap_global_test() ); |
| } |
| case else { |
| execute( tc_HashMap_global_test() ); |
| } |
| } |
| } |
| } // end of module |