Commit 8d3ab9e9 authored by zeiss's avatar zeiss
Browse files

No commit message

No commit message
parent 115e128d
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
/*****************************************************************
/*****************************************************************
 ** @author   STF 409
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @version  $Rev: 150 $
 ** @purpose  1:20, Ensure that the alt-statement works as expected for a simple loopback case.
 ** @purpose  1:20.2, Ensure that the alt-statement with a guard works as expected for a simple loopback case.
 ** @verdict  pass accept, ttcn3verdict:pass
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/
 *****************************************************************/


@@ -17,7 +17,7 @@ type component GeneralComp {


template charstring m_test := "ping";
template charstring m_test := "ping";


testcase TC_Sem_20_TopLevel_001() runs on GeneralComp {
testcase TC_Sem_20_TopLevel_002() runs on GeneralComp {
	p.send(m_test);
	p.send(m_test);
	var integer counter := 1;
	var integer counter := 1;
	alt {
	alt {
@@ -28,7 +28,7 @@ testcase TC_Sem_20_TopLevel_001() runs on GeneralComp {
}
}


control {
control {
	execute(TC_Sem_20_TopLevel_001());
	execute(TC_Sem_20_TopLevel_002());
}
}


}
}
 No newline at end of file
+39 −0
Original line number Original line Diff line number Diff line
/*****************************************************************
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @purpose  1:20.2, Ensure that the alt-statement processes the alternatives in order.
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

module Sem_20_TopLevel_003 {

type port MyPort message {
	inout charstring
}

type component GeneralComp { 
	port MyPort p;
}

template charstring m_test := "ping";

testcase TC_Sem_20_TopLevel_003() runs on GeneralComp {
	p.send(m_test);
	alt {
		[] p.receive(m_test) {
			setverdict(pass);
		}
		[] p.receive(m_test) {
			setverdict(fail);
		}
		[] p.receive(m_test) {
			setverdict(fail);
		}
	}
}

control {
	execute(TC_Sem_20_TopLevel_003());
}

}
 No newline at end of file
+53 −0
Original line number Original line Diff line number Diff line
/*****************************************************************
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @purpose  1:20.2, Ensure that activated defaults are processed in the reverse order.
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

module Sem_20_TopLevel_004 {

type port MyPort message {
	inout charstring
}

type component GeneralComp { 
	port MyPort p;
}

template charstring m_testOne := "ping1";
template charstring m_testTwo := "ping2";
template charstring m_testThree := "ping3"; // never sent!

altstep a_first() runs on GeneralComp {
	[] p.receive(m_testTwo) {
	}
}

altstep a_second() runs on GeneralComp {
	[] p.receive(m_testOne) { // if the altstep default aren't handled in the reverse order, the altstep will block.
		repeat;
	}
}

testcase TC_Sem_20_TopLevel_004() runs on GeneralComp {
	p.send(m_testOne);
	p.send(m_testTwo);

	var default v_defaultOne := activate(a_first());
	var default v_defaultTwo := activate(a_second());
	
	alt {
		[] p.receive(m_testThree) {
			setverdict(fail);
		}
	}
	
	setverdict(pass);
}

control {
	execute(TC_Sem_20_TopLevel_004(), 80E-3);  // if the altstep isn't handled after 80ms, we raise an error
}

}
 No newline at end of file
+44 −0
Original line number Original line Diff line number Diff line
/*****************************************************************
 ** @author   STF 409
 ** @version  $Rev: 150 $
 ** @purpose  1:20.2, Ensure that the else branch is executed when nothing else matched.
 ** @verdict  pass accept, ttcn3verdict:pass
 *****************************************************************/

module Sem_20_TopLevel_005 {

type port MyPort message {
	inout charstring
}

type component GeneralComp { 
	port MyPort p;
}

template charstring m_testOne := "ping1";
template charstring m_testTwo := "ping2";

testcase TC_Sem_20_TopLevel_005() runs on GeneralComp {
	p.send(m_testOne);
	p.send(m_testOne);

	alt {
		[] p.receive(m_testTwo) {
			setverdict(fail);
		}
		[false] p.receive(m_testTwo) {
			setverdict(fail);
		}
		[else] {
			setverdict(pass);
		}
	}
	
	setverdict(pass);
}

control {
	execute(TC_Sem_20_TopLevel_005(), 80E-3);  // if the altstep isn't handled after 80ms, we raise an error
}

}
 No newline at end of file