Commit 4447ee17 authored by urbant's avatar urbant
Browse files

No commit message

No commit message
parent 2e08fa3d
Loading
Loading
Loading
Loading
+45 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.3.5, raised exception type not in the list of available exceptions
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// Exceptions are specified as types. Therefore the exception value may either be derived 
// from a template or be the value resulting from an expression (which of course can be 
// an explicit value). The optional type field in the value specification to the raise 
// operation shall be used in cases where it is necessary to avoid any ambiguity of the type
// of the value being sent.

module NegSem_220305_raise_operation_001 {
	signature S() exception(charstring, octetstring);
	
	type port P procedure {
		inout S;
	}
	
    type component GeneralComp 
	{
		port P p;
	}
	
	function f() runs on GeneralComp
	{
		p.getcall(S:?);
		p.raise(S, 1);
        setverdict(pass);
	}
	
    testcase TC_NegSem_220305_raise_operation_001() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptc := GeneralComp.create;
		connect(self:p, v_ptc:p);
        v_ptc.start(f());
	    p.call(S:{}, nowait); // no processing of the exception to avoid possible errors in the catch operation
        v_ptc.done;
    }

    control {
        execute(TC_NegSem_220305_raise_operation_001(), 5.0);
    }
}
 No newline at end of file
+45 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.3.5, exception raised for a signature with no exception list
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// Exceptions are specified as types. Therefore the exception value may either be derived 
// from a template or be the value resulting from an expression (which of course can be 
// an explicit value). The optional type field in the value specification to the raise 
// operation shall be used in cases where it is necessary to avoid any ambiguity of the type
// of the value being sent.

module NegSem_220305_raise_operation_002 {
	signature S();
	
	type port P procedure {
		inout S;
	}
	
    type component GeneralComp 
	{
		port P p;
	}
	
	function f() runs on GeneralComp
	{
		p.getcall(S:?);
		p.raise(S, 1);
        setverdict(pass);
	}
	
    testcase TC_NegSem_220305_raise_operation_002() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptc := GeneralComp.create;
		connect(self:p, v_ptc:p);
        v_ptc.start(f());
	    p.call(S:{}, nowait); // no processing of the exception to avoid possible errors in the catch operation
        v_ptc.done;
    }

    control {
        execute(TC_NegSem_220305_raise_operation_002(), 5.0);
    }
}
 No newline at end of file
+48 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.3.5, raised exception type is ambiguous
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// Exceptions are specified as types. Therefore the exception value may either be derived 
// from a template or be the value resulting from an expression (which of course can be 
// an explicit value). The optional type field in the value specification to the raise 
// operation shall be used in cases where it is necessary to avoid any ambiguity of the type
// of the value being sent.

module NegSem_220305_raise_operation_003 {
    type integer MyInt1 (1..10);
    type integer MyInt2 (1..20);
    
	signature S() exception(MyInt1, MyInt2);
	
	type port P procedure {
		inout S;
	}
	
    type component GeneralComp 
	{
		port P p;
	}
	
	function f() runs on GeneralComp
	{
		p.getcall(S:?);
		p.raise(S, 1);
        setverdict(pass);
	}
	
    testcase TC_NegSem_220305_raise_operation_003() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptc := GeneralComp.create;
		connect(self:p, v_ptc:p);
        v_ptc.start(f());
	    p.call(S:{}, nowait); // no processing of the exception to avoid possible errors in the catch operation
        v_ptc.done;
    }

    control {
        execute(TC_NegSem_220305_raise_operation_003(), 5.0);
    }
}
 No newline at end of file
+47 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.3.5, missing to clause in case of 1 to n connection
 ** @verdict  pass reject
 *****************************************************************/
// The following requirements are tested:
// In case of one-to-one connections, the to clause may be omitted, because the receiving 
// entity is uniquely identified by the system structure.

module NegSem_220305_raise_operation_004 {
	signature S() exception(integer);
	
	type port P procedure {
		inout S;
	}
	
    type component GeneralComp 
	{
		port P p;
	}
	
	function f(integer p_expected) runs on GeneralComp
	{
        p.call(S:{}) {
            [] p.catch(S, p_expected) { setverdict(pass); }
            [] p.catch { setverdict(fail); }
        }
	}
	
    testcase TC_NegSem_220305_raise_operation_004() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptc1 := GeneralComp.create, v_ptc2 := GeneralComp.create;
		connect(self:p, v_ptc1:p);
        connect(self:p, v_ptc2:p);
        v_ptc1.start(f(1));
        v_ptc2.start(f(1));
        p.getcall(S:?);
        p.getcall(S:?); // call from both components expected
		p.raise(S, 1); // missing to clause: error expected
        all component.done;
        setverdict(pass);
    }

    control {
        execute(TC_NegSem_220305_raise_operation_004(), 5.0);
    }
}
 No newline at end of file
+47 −0
Original line number Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.3.5, exception on a message port
 ** @verdict  pass reject
 *****************************************************************/
// The following requirements are tested:
// An exception shall only be raised at a procedure-based port. An exception is a reaction 
// to an accepted procedure call the result of which leads to an exceptional event.

module NegSem_220305_raise_operation_005 {
	signature S() exception(integer);
	
	type port PSig procedure {
		inout S;
	}
    
    type port PMsg message {
		inout integer;
	}
	
    type component GeneralComp 
	{
		port PSig p1;
        port PMsg p2;
	}
	
	function f() runs on GeneralComp
	{
		p1.getcall(S:?);
		p2.raise(S, 1);
        setverdict(pass);
	}
	
    testcase TC_NegSem_220305_raise_operation_005() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptc := GeneralComp.create;
		connect(self:p1, v_ptc:p1);
        connect(self:p2, v_ptc:p2);
        v_ptc.start(f());
	    p1.call(S:{}, nowait); // no processing of the exception to avoid possible errors in the catch operation
        v_ptc.done;
    }

    control {
        execute(TC_NegSem_220305_raise_operation_005(), 5.0);
    }
}
 No newline at end of file
Loading