//Module parameters shall not be used in type or array definitions.
module NegSem_080201_ModuleParameters_006 {
modulepar integer MY_INT_MODULE_PARAMETER := 2;
type component GeneralComp {
}
type integer MyArrayType[MY_INT_MODULE_PARAMETER];
// error: Module parameters shall not be used in type or array definitions.
testcase TC_NegSem_080201_ModuleParameters_006() runs on GeneralComp {
var MyArrayType v_arr := {2,3};
if (v_arr[0] == 2) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control{
execute(TC_NegSem_080201_ModuleParameters_006());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Reference to an \(evaluable\) constant value was expected instead of module parameter `@NegSem_080201_ModuleParameters_006.MY_INT_MODULE_PARAMETER'
Restriction l) The template body at the right-hand side of the assignment symbol shall evaluate to a value or template, which is type compatible with the variable being declared.
*/
module NegSyn_1102_TemplateVars_002 {
type component GeneralComp {}
testcase TC_NegSyn_1102_TemplateVars_002() runs on GeneralComp {
var integer v_i1 := 1;
var template float v_i2 := v_i1; // error: v_i1 is integer, meanwhile template type is float
setverdict(pass);
}
control {
execute(TC_NegSyn_1102_TemplateVars_002());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Type mismatch: a value or template of type `float' was expected instead of `integer'
<TC - 15_001 Ensure that the expression or template body initializing a template shall evaluate to a value or template, which is type compatible with the template being declared. >
** @purpose 1:15, Ensure that the expression or template body initializing a template shall evaluate to a value or template, which is type compatible with the template being declared.
//Restriction C: the expression or template body initializing a template shall evaluate to a value or template, which is type compatible with the template being declared.
module NegSyn_15_TopLevel_001 {
type record MyRecord {
integer myInt
}
template MyRecord mw_myRecord := {
myInt := 2.1 // error: incompatible type (int req., float is given)