Commit 6df1b87c authored by urbant's avatar urbant
Browse files

Tests for 22.2.1 and 22.2.2

parent 4447ee17
Loading
Loading
Loading
Loading
+51 −0
Original line number Original line Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.2.1, missing to clause in case of one-to-many connections
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// Unicast, multicast and broadcast communication can be determined by the optional to clause
// in the send operation.  A to clause can be omitted in case of a one-to-one connection where
// unicast communication is used and the message receiver is uniquely determined by the test
// system structure.
// A to clause shall be present in case of one-to-many connections.

module NegSem_220201_SendOperation_005 {
	
	type port P message {
		inout integer;
	}
	
    type component GeneralComp 
	{
		port P p;
	}
	
	function f(integer p_expected) runs on GeneralComp
	{
        alt {
            [] p.receive(p_expected) { setverdict(pass); }
            [] p.receive { setverdict(fail); }
        }
	}
    
    const integer c_ptcCount := 2;
	
    testcase TC_NegSem_220201_SendOperation_005() runs on GeneralComp system GeneralComp {
        var GeneralComp v_ptcs[c_ptcCount];
        for (var integer i := 0; i < c_ptcCount; i := i + 1) {
            v_ptcs[i] := GeneralComp.create;
            connect(self:p, v_ptcs[i]:p);
            v_ptcs[i].start(f(0));
        }
		p.send(0);
        all component.done;
        setverdict(pass);
    }

    control {
        execute(TC_NegSem_220201_SendOperation_005(), 5.0);
    }
}
 No newline at end of file
+35 −0
Original line number Original line Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.2.1, partially initialized template
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// The TemplateInstance (and all parts of it) shall have a specific value i.e. the use 
// of matching mechanisms such as AnyValue is not allowed.

module NegSem_220201_SendOperation_006 {
	
    type record of integer RoI;    
    
	type port P message {
		inout RoI;
	}
	
    type component GeneralComp 
	{
		port P p;
	}
		
    testcase TC_NegSem_220201_SendOperation_006() runs on GeneralComp {
        var template RoI vm_msg := {1, -, 2};
        p.send(vm_msg);
        p.receive;
        setverdict(pass);
    }

    control {
        execute(TC_NegSem_220201_SendOperation_006(), 5.0);
    }
}
 No newline at end of file
+41 −0
Original line number Original line Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.2.1, no type prefix in inline template
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// When defining the message in-line, the optional type part shall be used if there is 
// ambiguity of the type of the message being sent.


module NegSem_220201_SendOperation_007 {
	
    type record R1 
    {
        integer field1,
        integer field2
    }
    
    type record of integer RoI;    
    
	type port P message {
		inout R1, RoI;
	}
	
    type component GeneralComp 
	{
		port P p;
	}
	
    testcase TC_NegSem_220201_SendOperation_007() runs on GeneralComp {
        p.send({1, 2});
        p.receive;
        setverdict(pass);
    }

    control {
        execute(TC_NegSem_220201_SendOperation_007(), 5.0);
    }
}
 No newline at end of file
+33 −0
Original line number Original line Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.2.1, incompatible address value in send operation
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// AddressRef shall be of type address, component or of the type provided in the address 
// declaration of the port type of the port instance referenced in the send operation.

module NegSem_220201_SendOperation_008 {
	
	type port P message {
		inout integer;
        address integer;
	}
    
    type component GeneralComp 
	{
		port P p;
	}
		
    testcase TC_NegSem_220201_SendOperation_008() runs on GeneralComp {
        p.send(1) to "127.0.0.1";
        p.receive(integer:?);
        setverdict(pass);
    }

    control {
        execute(TC_NegSem_220201_SendOperation_008(), 5.0);
    }
}
 No newline at end of file
+34 −0
Original line number Original line Diff line number Diff line
/*****************************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:22.2.1, null address in the to clause of send operation
 ** @verdict  pass reject
 *****************************************************************/

// The following requirements are tested:
// No AddressRef shall contain the special value null at the time of the operation.

module NegSem_220201_SendOperation_009 {
	
	type port P message {
		inout integer;        
	}
    
    type integer address;
    
    type component GeneralComp 
	{
		port P p;
	}
		
    testcase TC_NegSem_220201_SendOperation_009() runs on GeneralComp {
        var address v_addr := null;
        p.send(1) to v_addr;
        p.receive(integer:?);
        setverdict(pass);
    }

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