Commit 4bf43465 authored by zeiss's avatar zeiss
Browse files

No commit message

No commit message
parent 769c9215
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @purpose  1:15.10, Ensure that the valueof operation rejects valueof with non-concrete values, in this case omit.
 ** @verdict  pass reject
 *****************************************************************/

module NegSem_1510_ValueOfOperation_001 {

type component GeneralComp { }

testcase TC_NegSem_1510_ValueOfOperation_001() runs on GeneralComp {
	var template integer m_int := omit;
	var integer v_int := valueof(m_int);
	
	// if we get here, something must be wrong as valueof on m_int shall cause an error
	// due to the omit.
	setverdict(fail);
}

control{
    execute(TC_NegSem_1510_ValueOfOperation_001());
}

}
 No newline at end of file
+34 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @purpose  1:15.10, Ensure that the valueof operation rejects valueof with non-concrete values, in this case omit.
 ** @verdict  pass reject
 *****************************************************************/

module NegSem_1510_ValueOfOperation_002 {

type component GeneralComp { }

type record ExampleType {
	integer field1,
	boolean field2
}

template ExampleType m_template := {
	field1 := *,
	field2 := ?
}

testcase TC_NegSem_1510_ValueOfOperation_002() runs on GeneralComp {
	var ExampleType v_int := valueof(m_template);
	
	// if we get here, something must be wrong as valueof on m_template shall cause an error
	// due to the * and ? wildcards.
	setverdict(fail);
}

control{
    execute(TC_NegSem_1510_ValueOfOperation_002());
}

}
 No newline at end of file
+34 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @purpose  1:15.10, Ensure that the valueof operation rejects non-templates, in this case a structured type.
 ** @verdict  pass reject
 *****************************************************************/

module NegSem_1510_ValueOfOperation_003 {

type component GeneralComp { }

type record ExampleType {
	integer field1,
	boolean field2
}

testcase TC_NegSem_1510_ValueOfOperation_003() runs on GeneralComp {
	var ExampleType f_first := {
		field1 := 2,
		field2 := true
	};

	var ExampleType v_second := valueof(f_first);
	
	// if we get here, something must be wrong as valueof on m_template shall cause an error
	// as it is a value and not a template.
	setverdict(fail);
}

control{
    execute(TC_NegSem_1510_ValueOfOperation_003());
}

}
 No newline at end of file
+26 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @purpose  1:15.10, Ensure that the valueof operation rejects non-templates, in this case a basic type integer.
 ** @verdict  pass reject
 *****************************************************************/

module NegSem_1510_ValueOfOperation_004 {

type component GeneralComp { }

testcase TC_NegSem_1510_ValueOfOperation_004() runs on GeneralComp {
	var integer v_test := 2;

	var integer v_second := valueof(v_test);
	
	// if we get here, something must be wrong as valueof on v_test shall cause an error
	// as it is not a template.
	setverdict(fail);
}

control{
    execute(TC_NegSem_1510_ValueOfOperation_004());
}

}
 No newline at end of file
+38 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @purpose  1:15.10, Ensure that the valueof operation works as expected for fully initialized templates.
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

module Sem_1510_ValueOfOperation_001 {

type component GeneralComp { }

type record ExampleType {
	integer field1,
	boolean field2
}

template ExampleType m_template := {
	field1 := 1,
	field2 := true
}

testcase TC_Sem_1510_ValueOfOperation_001() runs on GeneralComp {
	var ExampleType v_value := valueof(m_template);

	if ((v_value.field1 == 1) and
	    (v_value.field2 == true)
	   ) {
		setverdict(pass);
	} else {
		setverdict(fail);
	}
}

control{
    execute(TC_Sem_1510_ValueOfOperation_001());
}

}
 No newline at end of file
Loading