diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021502_indexed_assignment_notation/Sem_06021502_indexed_assignment_notation_004.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021502_indexed_assignment_notation/Sem_06021502_indexed_assignment_notation_004.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..30fd5efe9b531523ee56f136e8a89fced259c68b --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021502_indexed_assignment_notation/Sem_06021502_indexed_assignment_notation_004.ttcn @@ -0,0 +1,29 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.2, map template with a wildcard + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// Templates of the map type can use a specific form of the mixed notation, where the first +// item is and asterisk representing the AnyElementsOrNone matching symbol, followed by one +// or more indexed assignments. + +module Sem_06021502_indexed_assignment_notation_004 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021502_indexed_assignment_notation_004() runs on C { + var template TMap v_map := { *, + ["first_name"] := "John", + ["surname"] := "Doe" + } + log(v_map); + setverdict(pass); + } + + control { + execute(TC_Sem_06021502_indexed_assignment_notation_004()); + } +} diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021503_unmapping_keys/Sem_06021503_unmapping_keys_003.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021503_unmapping_keys/Sem_06021503_unmapping_keys_003.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..7fb34c3042d8f4e263952ef894b29d46d84921b7 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021503_unmapping_keys/Sem_06021503_unmapping_keys_003.ttcn @@ -0,0 +1,39 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.3, unmapping AnyElementsOrNone from a map + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// The unmap statement may be also used to remove the AnyElementsOrNone matching symbol from +// a map template variable. In this case, the second parameter of the statement shall be +// an asterisk literal. + +module Sem_06021503_unmapping_keys_003 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021503_unmapping_keys_003() runs on C { + var template TMap v_map := { *, + ["first_name"] := "John", + ["surname"] := "Doe" + } + var TMap v_val := { + ["first_name"] := "John", + ["surname"] := "Doe", + ["city"] := "New York" + } + unmap(v_map, *); + + if (not match(v_val, v_map)) { // shall not match as the city field is missing from the template and the AnyElementsOrNone symbol has been removed + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_Sem_06021503_unmapping_keys_003()); + } +} diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021503_unmapping_keys/Sem_06021503_unmapping_keys_004.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021503_unmapping_keys/Sem_06021503_unmapping_keys_004.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..455f5d77c41beb1cae1d2895f344c90ed3bbaaea --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021503_unmapping_keys/Sem_06021503_unmapping_keys_004.ttcn @@ -0,0 +1,39 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.3, ignored unmapping AnyElementsOrNone from a map + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// The unmap statement may be also used to remove the AnyElementsOrNone matching symbol from +// a map template variable. In this case, the second parameter of the statement shall be +// an asterisk literal. If the template variable does not contain the AnyElementsOrNone +// matching symbol, the operation has no effect. + +module Sem_06021503_unmapping_keys_004 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021503_unmapping_keys_004() runs on C { + var template TMap v_map := { + ["first_name"] := ?, + ["surname"] := "Doe" + } + var TMap v_val := { + ["first_name"] := "John", + ["surname"] := "Doe" + } + unmap(v_map, *); // ignored as the referenced template doesn't contain AnyElementsOrNone + + if (match(v_val, v_map)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_Sem_06021503_unmapping_keys_004()); + } +} diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/NegSem_06021504_index_notation_007.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/NegSem_06021504_index_notation_007.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..ba9149d93031c4352714413ea3084105570cee53 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/NegSem_06021504_index_notation_007.ttcn @@ -0,0 +1,38 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.4, Using asterisk as an index: RHS not a boolean value + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When the asterisk symbol is used at the left hand side of an assignment, only the presence +// of the AnyElementsOrNone within the template is changed, values and keys remain unchanged. +// The right-hand side of the assignment shall resolve into a boolean value in this case. + +module NegSem_06021504_index_notation_007 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_NegSem_06021504_index_notation_007() runs on C { + var template TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe" + } + var TMap v_val := { + ["first_name"] := "John", + ["surname"] := "Doe" + } + v_map[*] := "test"; // type mismatch expected + + if (match(v_val, v_map)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_06021504_index_notation_007()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/NegSem_06021504_index_notation_008.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/NegSem_06021504_index_notation_008.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..85c3b8aa8da340a9c63309ad6be4392dfb5f3c1b --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/NegSem_06021504_index_notation_008.ttcn @@ -0,0 +1,32 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.4, Using asterisk as an index on RHS (typing issue) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The index notation, when used on the right-hand side, refers to the value element that the +// map value or template associates with the key given as the index or with the presence of +// the AnyElementsOrNone matching symbol if asterisk is used instead of the index. +// When used at the right-hand side of an assignment, the notation returns a boolean value +// indicating if the AnyElementsOrNone is present within the map template. + +module NegSem_06021504_index_notation_008 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_NegSem_06021504_index_notation_008() runs on C { + var template TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe" + } + var charstring v_str := v_map[*]; // type mismatch expected, the RHS resolves to a boolean value + log (v_str); + setverdict(pass); + } + + control { + execute(TC_NegSem_06021504_index_notation_008()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_007.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_007.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..ca9bb3eda66312014555b98097b80c396ad3be39 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_007.ttcn @@ -0,0 +1,39 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.4, Using asterisk as an index on LHS + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// When the asterisk symbol is used at the left hand side of an assignment, only the presence +// of the AnyElementsOrNone within the template is changed, values and keys remain unchanged. +// The right-hand side of the assignment shall resolve into a boolean value in this case. + +module Sem_06021504_index_notation_007 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021504_index_notation_007() runs on C { + var template TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe" + } + var TMap v_val := { + ["first_name"] := "John", + ["surname"] := "Doe", + ["city"] := "New York" + } + v_map[*] := true; // adding the AnyElementsOrNone field + + if (match(v_val, v_map)) { // shall match as AnyElementsOrNone is active and matches the city field + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_Sem_06021504_index_notation_007()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_008.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_008.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..69c3c429c157666dd57d56f1f91f6ef10f5c0649 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_008.ttcn @@ -0,0 +1,35 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.4, Using asterisk as an index on RHS + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// The index notation, when used on the right-hand side, refers to the value element that the +// map value or template associates with the key given as the index or with the presence of +// the AnyElementsOrNone matching symbol if asterisk is used instead of the index. +// When used at the right-hand side of an assignment, the notation returns a boolean value +// indicating if the AnyElementsOrNone is present within the map template. + +module Sem_06021504_index_notation_008 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021504_index_notation_008() runs on C { + var template TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe" + } + + if (not v_map[*]) { // AnyElementsOrNone isn't present + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_Sem_06021504_index_notation_008()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_009.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_009.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..9a2eb95be871f3e78177e8829aef941786a5106f --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_009.ttcn @@ -0,0 +1,34 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.4, Using asterisk as an index in isbound + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// Presence of the AnyElementsOrNone in a map template can be checked by using the isbound +// or ispresent operation with an index notation containing the asterisk symbol as its +// argument. + +module Sem_06021504_index_notation_009 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021504_index_notation_009() runs on C { + var template TMap v_map := { + *, + ["first_name"] := "John", + ["surname"] := "Doe" + } + + if (isbound(v_map[*])) { // AnyElementsOrNone is present + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_Sem_06021504_index_notation_009()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_010.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_010.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..53bbda667d2fceabbababdb7f59762eef894e1cc --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021504_index_notation/Sem_06021504_index_notation_010.ttcn @@ -0,0 +1,34 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.4, Using asterisk as an index in ispresent + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// Presence of the AnyElementsOrNone in a map template can be checked by using the isbound +// or ispresent operation with an index notation containing the asterisk symbol as its +// argument. + +module Sem_06021504_index_notation_009 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021504_index_notation_009() runs on C { + var template TMap v_map := { + *, + ["first_name"] := "John", + ["surname"] := "Doe" + } + + if (ispresent(v_map[*])) { // AnyElementsOrNone is present + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_Sem_06021504_index_notation_009()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/NegSem_06021509_optionality_of_map_element_values_001.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/NegSem_06021509_optionality_of_map_element_values_001.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f129f0a669e0b3d11987fe2c7cb9b200bb40e9a9 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/NegSem_06021509_optionality_of_map_element_values_001.ttcn @@ -0,0 +1,29 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.9, Using omit not allowed in map field values + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// In map values, both keys and value fields associated with them are mandatory. The omit +// symbol shall not be assigned to a map key or value field. + +module NegSem_06021509_optionality_of_map_element_values_001 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_NegSem_06021509_optionality_of_map_element_values_001() runs on C { + var TMap v_val := { + ["first_name"] := "John", + ["surname"] := "Doe", + ["city"] := omit + } + log(v_val); + setverdict(pass); + } + + control { + execute(TC_NegSem_06021509_optionality_of_map_element_values_001()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/NegSem_06021509_optionality_of_map_element_values_002.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/NegSem_06021509_optionality_of_map_element_values_002.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..1b98b790db6530168d94107a872dc08f21c7fe27 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/NegSem_06021509_optionality_of_map_element_values_002.ttcn @@ -0,0 +1,29 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.9, Matching symbol not allowed as a map key + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Keys of map templates shall not contain matching symbols. + +module NegSem_06021509_optionality_of_map_element_values_002 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_NegSem_06021509_optionality_of_map_element_values_002() runs on C { + var template charstring mw_key := ?; + var template TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe", + [mw_key] := ? + } + log(v_map); + setverdict(pass); + } + + control { + execute(TC_NegSem_06021509_optionality_of_map_element_values_002()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_001.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_001.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..1ee45c228cbc93b032b06a6c655f5526a4f418b1 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_001.ttcn @@ -0,0 +1,29 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.9, Using omit inside map templates + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// Value fields associated with keys of map templates might contain matching symbols including +// symbols for optional fields such as omit, * or ifpresent. + +module Sem_06021509_optionality_of_map_element_values_001 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021509_optionality_of_map_element_values_001() runs on C { + var template TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe", + ["city"] := omit + } + log(v_map); + setverdict(pass); + } + + control { + execute(TC_Sem_06021509_optionality_of_map_element_values_001()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_002.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_002.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..e99d743a5c734a0153ed6ab069d4d2d3d4a39a5d --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_002.ttcn @@ -0,0 +1,29 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.9, Using * inside map templates + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// Value fields associated with keys of map templates might contain matching symbols including +// symbols for optional fields such as omit, * or ifpresent. + +module Sem_06021509_optionality_of_map_element_values_002 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021509_optionality_of_map_element_values_002() runs on C { + var template TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe", + ["city"] := * + } + log(v_map); + setverdict(pass); + } + + control { + execute(TC_Sem_06021509_optionality_of_map_element_values_002()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_003.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_003.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..4c386d8a3745ab78e030e960ed5e1e578fa3e1d1 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/06021509_optionality_of_map_element_values/Sem_06021509_optionality_of_map_element_values_003.ttcn @@ -0,0 +1,29 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.15.9, Using ifpresent inside map templates + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// Value fields associated with keys of map templates might contain matching symbols including +// symbols for optional fields such as omit, * or ifpresent. + +module Sem_06021509_optionality_of_map_element_values_003 { + type map from charstring to charstring TMap; + type component C {} + + testcase TC_Sem_06021509_optionality_of_map_element_values_003() runs on C { + var template TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe", + ["city"] := "New York" ifpresent + } + log(v_map); + setverdict(pass); + } + + control { + execute(TC_Sem_06021509_optionality_of_map_element_values_003()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/0602_toplevel/NegSem_0602_TopLevel_011.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/0602_toplevel/NegSem_0602_TopLevel_011.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f77e0661f9be274e22ffed473da5eb6c16382ff1 --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/0602_toplevel/NegSem_0602_TopLevel_011.ttcn @@ -0,0 +1,32 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.0, duplicated indexes not allowed in assignment notation + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// In this notation each index shall not appear more than once and shall conform +// to the range of indices allowed by the type definition. + +module NegSem_0602_TopLevel_011 { + + type map from charstring to charstring TMap; + type component GeneralComp { + } + + testcase TC_NegSem_0602_TopLevel_011() runs on GeneralComp { + var TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe", + ["surname"] := "Smith" + }; + + log (v_map); + setverdict(pass); + } + + control { + execute(TC_NegSem_0602_TopLevel_011()); + } +} \ No newline at end of file diff --git a/ATS/core_language/06_types_and_values/0602_structured_types_and_values/0602_toplevel/Sem_0602_TopLevel_25.ttcn b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/0602_toplevel/Sem_0602_TopLevel_25.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..351d050dcb3c847a6cef19efe559037eb768d53d --- /dev/null +++ b/ATS/core_language/06_types_and_values/0602_structured_types_and_values/0602_toplevel/Sem_0602_TopLevel_25.ttcn @@ -0,0 +1,34 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:6.2.0, use of assignment notation for map types + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ + +// The following requirements are tested: +// The assignment and the mixed notation can be used for record, record of, set, and set of +// and map value notations and for arrays. + +module Sem_0602_TopLevel_025 { + + type component GeneralComp { + } + + type map from charstring to charstring TMap; + + testcase TC_Sem_0602_TopLevel_025() runs on GeneralComp { + + var TMap v_map := { + ["first_name"] := "John", + ["surname"] := "Doe", + ["city"] := "New York" + }; + + log (v_map); + setverdict(pass); + } + + control { + execute(TC_Sem_0602_TopLevel_025()); + } +} \ No newline at end of file diff --git a/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_054.ttcn b/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_054.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..77a6fffcbcee9dad6012580d8b59800352ea9877 --- /dev/null +++ b/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_054.ttcn @@ -0,0 +1,39 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:7.1.3, Comparison of equal map values + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ +// The following requirements are tested: +// Two maps are equal if and only if they are mutually compatible with the type of the other operand +// (see clause 6.3.8), they have the same number of key-value pairs and for each key-value pair in both +// maps there’s a key value pair in the other map where the key from one pair is equal to the key from +// the other pair and the value from one pair is equal to the value from the other pair. + +module Sem_070103_RelationalOperators_054 { + +type map from charstring to charstring TMap; + +type component GeneralComp { +} + +testcase TC_Sem_070103_RelationalOperators_054() runs on GeneralComp { + var TMap v_map1 := { + ["first_name"] := "John", + ["surname"] := "Doe" + }, v_map2; + v_map2["surname"] := "Doe"; + v_map2["first_name"] := "John"; + + if ( v_map1 == v_map2 ) { + setverdict(pass); + } else { + setverdict(fail); + } +} + +control{ + execute(TC_Sem_070103_RelationalOperators_054()); +} + +} \ No newline at end of file diff --git a/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_055.ttcn b/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_055.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..b8df709ec9fc3be9c19fc02e8fb192daeddb7fcc --- /dev/null +++ b/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_055.ttcn @@ -0,0 +1,40 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:7.1.3, Comparison of different map values (additional element) + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ +// The following requirements are tested: +// Two maps are equal if and only if they are mutually compatible with the type of the other operand +// (see clause 6.3.8), they have the same number of key-value pairs and for each key-value pair in both +// maps there’s a key value pair in the other map where the key from one pair is equal to the key from +// the other pair and the value from one pair is equal to the value from the other pair. + +module Sem_070103_RelationalOperators_055 { + +type map from charstring to charstring TMap; + +type component GeneralComp { +} + +testcase TC_Sem_070103_RelationalOperators_055() runs on GeneralComp { + var TMap v_map1 := { + ["first_name"] := "John", + ["surname"] := "Doe" + }, v_map2; + v_map2["surname"] := "Doe"; + v_map2["first_name"] := "John"; + v_map2["city"] := "New York"; + + if ( v_map1 != v_map2 ) { + setverdict(pass); + } else { + setverdict(fail); + } +} + +control{ + execute(TC_Sem_070103_RelationalOperators_055()); +} + +} \ No newline at end of file diff --git a/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_056.ttcn b/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_056.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..03ab1b55c485a01cde0c993be25409c4861c1ce6 --- /dev/null +++ b/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_056.ttcn @@ -0,0 +1,39 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:7.1.3, Comparison of different map values (different keys) + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ +// The following requirements are tested: +// Two maps are equal if and only if they are mutually compatible with the type of the other operand +// (see clause 6.3.8), they have the same number of key-value pairs and for each key-value pair in both +// maps there’s a key value pair in the other map where the key from one pair is equal to the key from +// the other pair and the value from one pair is equal to the value from the other pair. + +module Sem_070103_RelationalOperators_056 { + +type map from charstring to charstring TMap; + +type component GeneralComp { +} + +testcase TC_Sem_070103_RelationalOperators_056() runs on GeneralComp { + var TMap v_map1 := { + ["first-name"] := "John", + ["surname"] := "Doe" + }, v_map2; + v_map2["surname"] := "Doe"; + v_map2["first_name"] := "John"; + + if ( v_map1 != v_map2 ) { + setverdict(pass); + } else { + setverdict(fail); + } +} + +control{ + execute(TC_Sem_070103_RelationalOperators_056()); +} + +} \ No newline at end of file diff --git a/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_057.ttcn b/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_057.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..a17d10b7a971126a272d2f81a89ade6f36aa971b --- /dev/null +++ b/ATS/core_language/07_expressions/0701_operators/070103_relational_operators/Sem_070103_RelationalOperators_057.ttcn @@ -0,0 +1,39 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:7.1.3, Comparison of different map values (different values) + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ +// The following requirements are tested: +// Two maps are equal if and only if they are mutually compatible with the type of the other operand +// (see clause 6.3.8), they have the same number of key-value pairs and for each key-value pair in both +// maps there’s a key value pair in the other map where the key from one pair is equal to the key from +// the other pair and the value from one pair is equal to the value from the other pair. + +module Sem_070103_RelationalOperators_057 { + +type map from charstring to charstring TMap; + +type component GeneralComp { +} + +testcase TC_Sem_070103_RelationalOperators_057() runs on GeneralComp { + var TMap v_map1 := { + ["first_name"] := "John", + ["surname"] := "Doe" + }, v_map2; + v_map2["surname"] := "Doe"; + v_map2["first_name"] := "Joe"; + + if ( v_map1 != v_map2 ) { + setverdict(pass); + } else { + setverdict(fail); + } +} + +control{ + execute(TC_Sem_070103_RelationalOperators_057()); +} + +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_001.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_001.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..196cb00bfda2f7f245534e629374f38b103760e5 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_001.ttcn @@ -0,0 +1,44 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing omit on the RHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Omit: referencing an element within a map to which omit is assigned shall follow the rules +// specified in clause 6.2.15.7. + +module NegSem_150606_Referencing_map_elements_001 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_001() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := omit + }; + // expanding ? on the RHS + var template ProductInfo v_productTemplate := v_template.b["XS125"]; // shall cause an error + log (v_productTemplate); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_001()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_002.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_002.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..2d54cd307f9f2d0ebfcc6465f4e3a7b2d61f93b1 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_002.ttcn @@ -0,0 +1,56 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing a list on the RHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Template lists and complemented lists: referencing an element within a map field to which +// a list or complemented list is assigned, shall cause an error. + +module NegSem_150606_Referencing_map_elements_002 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_002() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := ({ + ["XS125"] := { + producer := "Yoomstick Tec", + model := ?, + description := * + } + }, { + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := ?, + description := * + } + }) + }; + // expanding template list on the RHS + var template ProductInfo v_productTemplate := v_template.b["XS125"]; // shall cause an error + log (v_productTemplate); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_002()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_003.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_003.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..0f1f3b55e961a848de5e8c7d489decdcd8388a5d --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_003.ttcn @@ -0,0 +1,56 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing a list on the LHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Template lists and complemented lists: referencing an element within a map field to which +// a list or complemented list is assigned, shall cause an error. + +module NegSem_150606_Referencing_map_elements_003 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_003() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := ({ + ["XS125"] := { + producer := "Yoomstick Tec", + model := ?, + description := * + } + }, { + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := ?, + description := * + } + }) + }; + // expanding template list on the LHS + v_template.b["YU046"] := ?; // shall cause an error + log (v_template); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_003()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_004.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_004.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..2067ff83356b35c98c8863876ff52a41b2e72750 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_004.ttcn @@ -0,0 +1,56 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing a complemented list on the RHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Template lists and complemented lists: referencing an element within a map field to which +// a list or complemented list is assigned, shall cause an error. + +module NegSem_150606_Referencing_map_elements_004 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_004() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := complement ({ + ["XS125"] := { + producer := "Yoomstick Tec", + model := ?, + description := * + } + }, { + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := ?, + description := * + } + }) + }; + // expanding complemented list on the RHS + var template ProductInfo v_productTemplate := v_template.b["XS125"]; // shall cause an error + log (v_productTemplate); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_004()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_005.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_005.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..3706f73b618a32aefb2dd6512271681f93cbe24c --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_005.ttcn @@ -0,0 +1,56 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing a complemented list on the LHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Template lists and complemented lists: referencing an element within a map field to which +// a list or complemented list is assigned, shall cause an error. + +module NegSem_150606_Referencing_map_elements_005 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_005() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := complement ({ + ["XS125"] := { + producer := "Yoomstick Tec", + model := ?, + description := * + } + }, { + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := ?, + description := * + } + }) + }; + // expanding complemented list on the LHS + v_template.b["YU046"] := ?; // shall cause an error + log (v_template); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_005()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_006.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_006.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..a93092c551098e58345caa94f039dee727bafe08 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_006.ttcn @@ -0,0 +1,44 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing AnyValueOrNone on the RHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Referencing an element within a map template or field to which AnyValueOrNone is assigned +// on the right hand side of an assignment shall cause an error. + +module NegSem_150606_Referencing_map_elements_006 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_006() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := * + }; + // expanding * on the RHS + var template ProductInfo v_productTemplate := v_template.b["XS125"]; // shall cause an error + log (v_productTemplate); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_006()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_007.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_007.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..8eb912aaf79ec33808d52027e90dfc0322a20392 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_007.ttcn @@ -0,0 +1,51 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing ifpresent on the RHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Ifpresent attribute: referencing an element within a map template or field to which +// the ifpresent attribute is attached, shall cause an error (irrespective of the value or +// the matching mechanism to which ifpresent is appended). + +module NegSem_150606_Referencing_map_elements_007 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_007() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := ?, + description := * + } + } ifpresent + }; + // expanding ifpresent on the RHS + var template ProductInfo v_productTemplate := v_template.b["XS125"]; // shall cause an error + log (v_productTemplate); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_007()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_008.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_008.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..fe2203afd0362cfaa0b1722033847a93783c09e9 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_008.ttcn @@ -0,0 +1,51 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing ifpresent on the LHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Ifpresent attribute: referencing an element within a map template or field to which +// the ifpresent attribute is attached, shall cause an error (irrespective of the value or +// the matching mechanism to which ifpresent is appended). + +module NegSem_150606_Referencing_map_elements_008 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_008() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := ?, + description := * + } + } ifpresent + }; + // expanding ifpresent on the LHS + v_template.b["XS125"].model := "BrooMAX 194"; // shall cause an error + log (v_template); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_008()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_009.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_009.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f986ed7390c2c9f504949d9961976e846bfd3977 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_009.ttcn @@ -0,0 +1,37 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing null on the RHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Special value null: referencing an element of an address type that is derived +// from a map type and whose actual value is null shall cause an error. + +module NegSem_150606_Referencing_map_elements_009 { + + type record HostInfo { + charstring ipAddr, + charstring domain, + integer portNr + }; + + type map from charstring to HostInfo address; + + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_009() runs on GeneralComp { + var template address v_template := null; + // expanding null on the RHS + var template charstring v_addr := v_template["Station1"].ipAddr; // shall cause an error + log (v_addr); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_009()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_010.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_010.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..dfe3053b60abddadb734462acf30bf99c168c5d2 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/NegSem_150606_Referencing_map_elements_010.ttcn @@ -0,0 +1,37 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing null on the LHS + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Special value null: referencing an element of an address type that is derived +// from a map type and whose actual value is null shall cause an error. + +module NegSem_150606_Referencing_map_elements_010 { + + type record HostInfo { + charstring ipAddr, + charstring domain, + integer portNr + }; + + type map from charstring to HostInfo address; + + + type component GeneralComp { + } + + testcase TC_NegSem_150606_Referencing_map_elements_010() runs on GeneralComp { + var template address v_template := null; + // expanding null on the LHS + v_template["Station1"].ipAddr := "127.0.0.1"; // shall cause an error + log (v_template); + setverdict(pass); + } + + control{ + execute(TC_NegSem_150606_Referencing_map_elements_010()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_001.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_001.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..9bdcb1a5525a85784770c1eaefc9153efbe635bd --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_001.ttcn @@ -0,0 +1,42 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing omit on the LHS + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ + +// The following requirements are tested: +// Omit: referencing an element within a map to which omit is assigned shall follow the rules +// specified in clause 6.2.15.7. + +module Sem_150606_Referencing_map_elements_001 { + + type map from charstring to charstring TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_150606_Referencing_map_elements_001() runs on GeneralComp { + var template TRec v_msg := { + a := 1, + b := omit + }; + // expanding omit on the LHS + v_msg.b["surname"] := "Doe"; + + if (valueof(v_msg) == { a := 1, b := { ["surname"] := "Doe" }}) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_150606_Referencing_map_elements_001()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_002.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_002.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..399f4531eff3df26203a907ac5f73a77cc9d67eb --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_002.ttcn @@ -0,0 +1,48 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing AnyValue on the RHS + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ + +// The following requirements are tested: +// When referencing an element of a map template or field to which AnyValue is assigned, +// at the right hand side of an assignment, AnyValueOrNone shall be returned. + +module Sem_150606_Referencing_map_elements_002 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_150606_Referencing_map_elements_002() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := ? + }; + // expanding ? on the RHS + var template ProductInfo v_productTemplate := v_template.b["XS125"]; + log (v_productTemplate); // expecting * + if (istemplatekind(v_productTemplate, "*")) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_150606_Referencing_map_elements_002()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_003.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_003.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..4faf4ce34e35df26f5d0795ecf34a1a212647f73 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_003.ttcn @@ -0,0 +1,65 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing AnyValue on the LHS + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ + +// The following requirements are tested: +// When referencing an element within a map template or field to which AnyValue is assigned, +// at the left hand side of an assignment, the template or field is implicitly expanded +// recursively up to and including, the depth of the referenced subfield and AnyValue is +// assigned to the referenced field. Then the value or matching mechanism at the right hand +// side of the assignment shall be assigned to the referenced field and AnyElementsOrNone +// shall be added to the map template. + +module Sem_150606_Referencing_map_elements_003 { + + type map from charstring to record { + charstring producer, + charstring model, + charstring description optional + } TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_150606_Referencing_map_elements_003() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := ? + }; + // expanding ? on the LHS + v_template.b["XS125"].producer := "Yoomstick Tec"; + log (v_template); // expecting { a := 1, b := {*, ["XS125"] := { producer := "Yoomstick Tec", model := ?, description := * } } + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_150606_Referencing_map_elements_003()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_004.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_004.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..b79dc7089d8fd8b2926d83b16b4e7de695a82fc7 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_004.ttcn @@ -0,0 +1,62 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing AnyValueOrNone on the LHS + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ + +// The following requirements are tested: +// When referencing an element within a map template or field to which AnyValueOrNone is +// assigned on the left hand side of an assignment, the rules for AnyValue shall apply +// (see item c) for more details). + +module Sem_150606_Referencing_map_elements_004 { + + type map from charstring to record { + charstring producer, + charstring model, + charstring description optional + } TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_150606_Referencing_map_elements_004() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := * + }; + // expanding ? on the LHS + v_template.b["XS125"].producer := "Yoomstick Tec"; + log (v_template); // expecting { a := 1, b := {*, ["XS125"] := { producer := "Yoomstick Tec", model := ?, description := * } } + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_150606_Referencing_map_elements_004()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_005.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_005.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..ef3e643a9c046a6d62aece0a29ac7804d820999f --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_005.ttcn @@ -0,0 +1,53 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing AnyElementsOrNone on the RHS + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ + +// The following requirements are tested: +// When referencing an element of a map template or field that contains AnyElementsOrNone, +// if the referenced element is not present and the reference occurs on the right-hand side +// of an assignment, AnyValueOrNone shall be returned. + +module Sem_150606_Referencing_map_elements_005 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_150606_Referencing_map_elements_005() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + *, + ["XS125"] := ?, + ["DZ506"] := ? + } + }; + // expanding AnyElementsOrNone on the RHS (key YU046 not present in the map) + var template ProductInfo v_productTemplate := v_template.b["YU046"]; + log (v_productTemplate); // expecting * + if (istemplatekind(v_productTemplate, "*")) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_150606_Referencing_map_elements_005()); + } +} \ No newline at end of file diff --git a/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_006.ttcn b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_006.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..2745c5fab9d2510796e556ff0d3f9da5f6983ff5 --- /dev/null +++ b/ATS/core_language/15_templates/1506_referencing_elements_of_templates_or_template_fields/150606_Referencing_map_elements/Sem_150606_Referencing_map_elements_006.ttcn @@ -0,0 +1,68 @@ +/***************************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:15.6.6, Expanding map containing AnyElementsOrNone on the LHS + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ + +// The following requirements are tested: +// When referencing an element of a map template or field that contains AnyElementsOrNone, +// if the referenced element is not present and the reference occurs on the left-hand side +// of an assignment, the template or field is implicitly expanded recursively up to and +// including, the depth of the referenced subfield and AnyValue is assigned to the referenced +// field. Then the value or matching mechanism at the right hand side of the assignment shall +// be assigned to the referenced field and AnyElementsOrNone shall be added to the map template. + +module Sem_150606_Referencing_map_elements_006 { + + type map from charstring to record { + charstring producer, + charstring model, + charstring description optional + } TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_150606_Referencing_map_elements_006() runs on GeneralComp { + var template TRec v_template := { + a := 1, + b := { + *, + ["XS125"] := ? + } + }; + // expanding AnyElementsOrNone on the LHS (key DZ506 not present) + v_template.b["DZ506"].producer := "XanDonHua Mechanics"; + log (v_template); // expecting { a := 1, b := {*, ["XS125"] := ?, ["DZ506"] := { producer := "XanDonHua Mechanics", model := ?, description := * } } } + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_150606_Referencing_map_elements_006()); + } +} \ No newline at end of file diff --git a/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200500_general/Sem_200500_general_001.ttcn b/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200500_general/Sem_200500_general_001.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..ae79dcc99a69a1a28a938c6db08815d0d90b52bf --- /dev/null +++ b/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200500_general/Sem_200500_general_001.ttcn @@ -0,0 +1,54 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:20.5.0, order of default after re-activating suspended default + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// Re-activated defaults that were previously suspended retain their position in the list. +// The deactivate operation either removes a default from the list or suspends it in which +// case the default remains in the list, but is temporarily inactive. + +module Sem_200500_general_001 { + + type port P message { + inout integer; + } + + type component GeneralComp { + port P p; + } + + altstep a() runs on GeneralComp { + [] p.receive(integer:?) { + log ("in altstep a"); + setverdict(pass); + } + } + + altstep b() runs on GeneralComp { + [] p.receive(integer:?) { + log ("in altstep b"); + setverdict(fail); + } + } + + testcase TC_Sem_200500_general_001() runs on GeneralComp system GeneralComp { + connect(self:p, self:p); + var default v_default := activate(b()); + activate(a()); + p.send(integer:5); + deactivate(v_default); + activate(v_default); + alt { + [] p.receive(integer:0) { // not expected: leads to default invocation + setverdict(fail); + } + } + } + + control{ + execute(TC_Sem_200500_general_001()); + } +} diff --git a/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200501_the_default_mechanism/NegSem_200501_the_default_mechanism_002.ttcn b/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200501_the_default_mechanism/NegSem_200501_the_default_mechanism_002.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..bd8e64f08e4a2c630510d5d32119cbd496aa1145 --- /dev/null +++ b/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200501_the_default_mechanism/NegSem_200501_the_default_mechanism_002.ttcn @@ -0,0 +1,54 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:20.5.0, all defaults in suspended state + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// An unsuccessful default execution will also be indicated if the list of defaults is +// empty or if it contains only suspended defaults. + +module NegSem_200501_the_default_mechanism_002 { + + type port P message { + inout integer; + } + + type component GeneralComp { + port P p; + } + + altstep a() runs on GeneralComp { + [] p.receive(integer:?) { + log ("in altstep a"); + setverdict(pass); + } + } + + altstep b() runs on GeneralComp { + [] p.receive(integer:?) { + log ("in altstep b"); + setverdict(pass); + } + } + + testcase TC_NegSem_200501_the_default_mechanism_002() runs on GeneralComp system GeneralComp { + connect(self:p, self:p); + var default v_defaultB := activate(b()); + var default v_defaultA := activate(a()); + p.send(integer:5); + deactivate(v_defaultA); + deactivate(v_defaultB); + alt { + [] p.receive(integer:0) { // not expected + setverdict(fail); + } + } // as no default is active and the only option not matching, an error should occur + setverdict(pass); + } + + control{ + execute(TC_NegSem_200501_the_default_mechanism_002()); + } +} diff --git a/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200501_the_default_mechanism/Sem_200501_the_default_mechanism_009.ttcn b/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200501_the_default_mechanism/Sem_200501_the_default_mechanism_009.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..ad99b31923acb768417e5c5145c0b46092db6b6e --- /dev/null +++ b/ATS/core_language/20_statement_and_operations_for_alt/2005_default_handling/200501_the_default_mechanism/Sem_200501_the_default_mechanism_009.ttcn @@ -0,0 +1,52 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:20.5.0, suspended default not invoked + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// In the case of an unsuccessful termination, the default mechanism invokes the next +// default in the list that is not in the suspended state. + +module Sem_200501_the_default_mechanism_009 { + + type port P message { + inout integer; + } + + type component GeneralComp { + port P p; + } + + altstep a() runs on GeneralComp { + [] p.receive(integer:?) { + log ("in altstep a"); + setverdict(pass); + } + } + + altstep b() runs on GeneralComp { + [] p.receive(integer:?) { + log ("in altstep b"); + setverdict(fail); + } + } + + testcase TC_Sem_200501_the_default_mechanism_009() runs on GeneralComp system GeneralComp { + connect(self:p, self:p); + var default v_default := activate(b()); + activate(a()); + p.send(integer:5); + deactivate(v_default); + alt { + [] p.receive(integer:0) { // not expected: leads to default invocation + setverdict(fail); + } + } + } + + control{ + execute(TC_Sem_200501_the_default_mechanism_009()); + } +} diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010204_any_value_or_none/Sem_B010204_any_value_or_none_006.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010204_any_value_or_none/Sem_B010204_any_value_or_none_006.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..31b97c533601f4a9db562984676be4ec6a24364a --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010204_any_value_or_none/Sem_B010204_any_value_or_none_006.ttcn @@ -0,0 +1,66 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.2.4, AnyValueOrNone in a map field (field present) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// A map template key that uses this symbol instead of an associated value matches +// the corresponding key if, and only if, either the corresponding key is present +// and its associated value evaluates to any value of the specified type, or if +// the corresponding key is absent. + +module Sem_B010204_any_value_or_none_006 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010204_any_value_or_none_006() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + ["XS125"] := ?, + ["DZ506"] := * + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010204_any_value_or_none_006()); + } + +} diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010204_any_value_or_none/Sem_B010204_any_value_or_none_007.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010204_any_value_or_none/Sem_B010204_any_value_or_none_007.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..d3159cbd807f4171d6d5b225d4eff96cddb80193 --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010204_any_value_or_none/Sem_B010204_any_value_or_none_007.ttcn @@ -0,0 +1,61 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.2.4, AnyValueOrNone in a map field (field missing) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// A map template key that uses this symbol instead of an associated value matches +// the corresponding key if, and only if, either the corresponding key is present +// and its associated value evaluates to any value of the specified type, or if +// the corresponding key is absent. + +module Sem_B010204_any_value_or_none_007 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010204_any_value_or_none_007() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + ["XS125"] := ?, + ["DZ506"] := * + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010204_any_value_or_none_007()); + } + +} diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010208_omit_value/Sem_B010208_omit_value_006.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010208_omit_value/Sem_B010208_omit_value_006.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..6338e9f4b141329b38a8c72855487367256a5db6 --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010208_omit_value/Sem_B010208_omit_value_006.ttcn @@ -0,0 +1,60 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.2.8, omit in a map field (field missing) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// The keyword omit denotes that an optional field of a record or set or a specific +// key within a map shall be absent. If used as a matching mechanism, it matches +// an optional field or a map key if and only if it is absent. + +module Sem_B010208_omit_value_006 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010208_omit_value_006() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + ["XS125"] := ?, + ["DZ506"] := omit + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010208_omit_value_006()); + } + +} \ No newline at end of file diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010208_omit_value/Sem_B010208_omit_value_007.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010208_omit_value/Sem_B010208_omit_value_007.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..a20b63843496c57275f1fa9ea911ff52a5aebf2d --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0102_matching_mechanisms/B010208_omit_value/Sem_B010208_omit_value_007.ttcn @@ -0,0 +1,65 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.2.8, omit in a map field (field present) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// The keyword omit denotes that an optional field of a record or set or a specific +// key within a map shall be absent. If used as a matching mechanism, it matches +// an optional field or a map key if and only if it is absent. + +module Sem_B010208_omit_value_007 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010208_omit_value_007() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + ["XS125"] := ?, + ["DZ506"] := omit + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + } + } + }; + if (not match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010208_omit_value_007()); + } + +} diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0103_matching_inside_values/B010302_any_number_of_elements_or_none/Sem_B010302_any_number_of_elements_or_none_004.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0103_matching_inside_values/B010302_any_number_of_elements_or_none/Sem_B010302_any_number_of_elements_or_none_004.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f16ece0185bd7dac8287727d7eeb2a869e6a2784 --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0103_matching_inside_values/B010302_any_number_of_elements_or_none/Sem_B010302_any_number_of_elements_or_none_004.ttcn @@ -0,0 +1,65 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.3.2, AnyElementsOrNone inside a map template (no additional fields) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// AnyElementsOrNone is also used in templates of a map type where it replaces none or +// any number of elements whose keys are not present in the map template. + +module Sem_B010302_any_number_of_elements_or_none_004 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010302_any_number_of_elements_or_none_004() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + *, + ["XS125"] := ?, + ["DZ506"] := ? + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010302_any_number_of_elements_or_none_004()); + } + +} diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0103_matching_inside_values/B010302_any_number_of_elements_or_none/Sem_B010302_any_number_of_elements_or_none_005.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0103_matching_inside_values/B010302_any_number_of_elements_or_none/Sem_B010302_any_number_of_elements_or_none_005.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..6ac55dd11d92b883dd3296b301e168664f108fb2 --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0103_matching_inside_values/B010302_any_number_of_elements_or_none/Sem_B010302_any_number_of_elements_or_none_005.ttcn @@ -0,0 +1,75 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.3.2, AnyElementsOrNone inside a map template (additional fields) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// AnyElementsOrNone is also used in templates of a map type where it replaces none or +// any number of elements whose keys are not present in the map template. + +module Sem_B010302_any_number_of_elements_or_none_005 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010302_any_number_of_elements_or_none_005() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + *, + ["XS125"] := ?, + ["DZ506"] := ? + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + }, + ["MG532"] := { + producer := "El Mundo Grande de Leon", + model := "Crudajero XD", + description := "With exotic South American vibes" + }, + ["BX920"] := { + producer := "Jambambuja", + model := "Kilimandjaro dream", + description := "Made from high quality African hardwood" + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010302_any_number_of_elements_or_none_005()); + } + +} diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_003.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_003.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..c4cbb2cf6de374b2c4ad263d2c117e6382fe1e2e --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_003.ttcn @@ -0,0 +1,69 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.4.2, ifpresent in a map field (field present and matches) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// A map template key that uses the ifpresent indicator in the value associated with +// it matches the corresponding key if, and only if, either the corresponding key is +// present and its value matches according to the associated matching mechanism, or +// if the corresponding key is absent. + +module Sem_B010402_ifPresent_indicator_003 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010402_ifPresent_indicator_003() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + ["XS125"] := ?, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := ?, + description := * + } ifpresent + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010402_ifPresent_indicator_003()); + } + +} \ No newline at end of file diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_004.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_004.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..94c65cea0b5c71e165ab579b7f58dc3c82997746 --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_004.ttcn @@ -0,0 +1,69 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.4.2, ifpresent in a map field (field present and doesn't match) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// A map template key that uses the ifpresent indicator in the value associated with +// it matches the corresponding key if, and only if, either the corresponding key is +// present and its value matches according to the associated matching mechanism, or +// if the corresponding key is absent. + +module Sem_B010402_ifPresent_indicator_004 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010402_ifPresent_indicator_004() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + ["XS125"] := ?, + ["DZ506"] := { + producer := "El Mundo Grande de Leon", + model := ?, + description := * + } ifpresent + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + }, ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := "RS-469-23", + description := "Top quality product with many outstanging features" + } + } + }; + if (not match(v_val, v_template)) { // a different producer in the value shall cause a mismatch + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010402_ifPresent_indicator_004()); + } + +} \ No newline at end of file diff --git a/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_005.ttcn b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_005.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..ebf3a2289c15cb2cd8439c423f449d3bfb7b2c56 --- /dev/null +++ b/ATS/core_language/B_matching_incoming_values/B01_template_matching/B0104_matching_attributes_of_values/B010402_ifPresent_indicator/Sem_B010402_ifPresent_indicator_005.ttcn @@ -0,0 +1,65 @@ +/*************************************************** + ** @author TTF T023 + ** @version 0.0.1 + ** @purpose 1:B.1.4.2, ifpresent in a map field (field missing) + ** @verdict pass accept, ttcn3verdict:pass + ***************************************************/ + +// The following requirement is tested: +// A map template key that uses the ifpresent indicator in the value associated with +// it matches the corresponding key if, and only if, either the corresponding key is +// present and its value matches according to the associated matching mechanism, or +// if the corresponding key is absent. + +module Sem_B010402_ifPresent_indicator_005 { + + type record ProductInfo { + charstring producer, + charstring model, + charstring description optional + }; + + type map from charstring to ProductInfo TMap; + + type record TRec { + integer a, + TMap b optional + } + + type component GeneralComp { + } + + testcase TC_Sem_B010402_ifPresent_indicator_005() runs on GeneralComp { + var template TRec v_template := { + a := ?, + b := { + ["XS125"] := ?, + ["DZ506"] := { + producer := "XanDonHua Mechanics", + model := ?, + description := * + } ifpresent + } + }; + var TRec v_val := { + a := 1, + b := { + ["XS125"] := { + producer := "Yoomstick Tec", + model := "BrooMAX 194", + description := omit + } + } + }; + if (match(v_val, v_template)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_Sem_B010402_ifPresent_indicator_005()); + } + +} \ No newline at end of file