Commit 912489ad authored by Matthias Simon's avatar Matthias Simon
Browse files

Merge branch 'v15-unvalidated-elvior' into 'v15-unvalidated'

V15 unvalidated Elvior

See merge request !4
parents 66c945ea 871c60a6
Loading
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
/***************************************************
 ** @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());
	}
}
+39 −0
Original line number Diff line number Diff line
/***************************************************
 ** @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());
	}
}
+39 −0
Original line number Diff line number Diff line
/***************************************************
 ** @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());
	}
}
+38 −0
Original line number Diff line number Diff line
/***************************************************
 ** @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
+32 −0
Original line number Diff line number Diff line
/***************************************************
 ** @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
Loading