Commit a7c3674c authored by urbant's avatar urbant
Browse files

Test for new rules of 4.7.1 concerning record, record-of and set-of values

parent 409c24ca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 451
 ** @version  0.0.1
 ** @purpose  1:6.2.1, The dot notation used in record type definitions is correctly handled
 ** @purpose  1:6.2.1.1, The dot notation used in record type definitions is correctly handled
 ** @verdict  pass reject
 ***************************************************/
module NegSem_06020101_ReferencingRecordFields_001 {
+35 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.1.1, verify that record fields cannot reference themselves
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Fields of record type definitions shall not reference themselves.

module NegSem_06020101_ReferencingRecordFields_002 {

    type component GeneralComp {	    	    
    }
    
    type record R {	
        integer	field1,
        R.field2 field2 optional, // this circular reference is NOT ALLOWED
        boolean	field3
    }  
    
    testcase TC_NegSem_06020101_ReferencingRecordFields_002() runs on GeneralComp {
        var R v_rec := { field1 := 1, field2 := omit, field3 := true };
        if (v_rec.field1 == 1) {
            setverdict(pass);
        } else {
            setverdict(fail);
        }
    }
    
    control {
        execute(TC_NegSem_06020101_ReferencingRecordFields_002());
    }

}
+38 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.1.1, verify that referencing uninitialized record on the right hand of an assignment is not allowed
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Referencing a subfield of an uninitialized or omitted record field or value on the right 
// hand side of an assignment shall cause an error.

module NegSem_06020101_ReferencingRecordFields_003 {

    type component GeneralComp {	    	    
    }
    
    type record R {
        record {
            integer subfield1
        } field1,
        charstring field2 optional
    }  
    
    testcase TC_NegSem_06020101_ReferencingRecordFields_003() runs on GeneralComp {
        var R v_rec;
        v_rec.field2 := "abc";
        if (v_rec.field1.subfield1 == 5) {
	        setverdict(fail);
        } else {
	        setverdict(pass);
        }
    }
    
    control {
        execute(TC_NegSem_06020101_ReferencingRecordFields_003());
    }

}
+39 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.1.1, verify that referencing omitted record on the right hand of an assignment is not allowed
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Referencing a subfield of an uninitialized or omitted record field or value on the right 
// hand side of an assignment shall cause an error.

module NegSem_06020101_ReferencingRecordFields_004 {

    type component GeneralComp {	    	    
    }
    
    type record R {
        record {
            integer subfield1
        } field1 optional,
        charstring field2 optional
    }  
    
    testcase TC_NegSem_06020101_ReferencingRecordFields_004() runs on GeneralComp {
        var R v_rec;
        v_rec.field1 := omit;
        v_rec.field2 := "abc";
        if (v_rec.field1.subfield1 == 5) {
	        setverdict(fail);
        } else {
	        setverdict(pass);
        }
    }
    
    control {
        execute(TC_NegSem_06020101_ReferencingRecordFields_004());
    }

}
+1 −1
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 451
 ** @version  0.0.1
 ** @purpose  1:6.2.1, The dot notation used in record type definitions is correctly handled
 ** @purpose  1:6.2.1.1, The dot notation used in record type definitions is correctly handled
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/
module Sem_06020101_ReferencingRecordFields_001 {
Loading