Commit af597db1 authored by urbant's avatar urbant
Browse files

Tests for 6.2.4

parent 31903674
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.7, not unique identifiers in enumerated type declaration
 ** @verdict  pass accept, noexecution
 ***************************************************/

// The following requirement is tested:
// The identifiers of enumerated values shall be unique within the enumerated type 
// (but do not have to be globally unique) and are consequently visible in the 
// context of the given type only.

module NegSyn_060204_enumerated_type_and_values_001 {

    type enumerated MyFirstEnumType {
        Monday, Tuesday, Wednesday, Thursday, Friday, Monday
    };
}
+17 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.4, two equal user-assigned enumerated values
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// Each user-assigned integer number shall be distinct within a single enumerated 
// type. 

module NegSem_060204_enumerated_type_and_values_002 {

    type enumerated MyFirstEnumType {
        Monday, Tuesday(2), Wednesday(2), Thursday, Friday
    };
}
+36 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.4, using enumerated value number directly (left hand side of assignments)
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// For each enumerated value without an assigned integer value, the system 
// successively associates an integer number in the textual order of the 
// enumerated values, starting at the left-hand side, beginning with zero, by 
// step 1 and skipping any number occupied by any of the enumerated values with 
// a manually assigned value. These values are only used by the system to allow 
// the use of relational operators. The user shall not directly use associated 
// integer values but can access them and convert integer values into enumerated 
// values by using the predefined functions enum2int and int2enum (see clauses 
// 16.1.2, C.1.29 C.1.30 and C.1.4 C.1.4).

module NegSem_060204_enumerated_type_and_values_003 {

    type component GeneralComp {
	}
    
    type enumerated EDays {
        Monday, Tuesday, Wednesday, Thursday, Friday
    };
    
    testcase TC_NegSem_060204_enumerated_type_and_values_003() runs on GeneralComp {
        var EDays v_day0 := 0; // ordinal value shall not be accepted
		setverdict(pass);
	}
	
	control {
		execute(TC_NegSem_060204_enumerated_type_and_values_003());
	}
}
+37 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.4, using enumerated value number directly (right hand side of assignments)
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// For each enumerated value without an assigned integer value, the system 
// successively associates an integer number in the textual order of the 
// enumerated values, starting at the left-hand side, beginning with zero, by 
// step 1 and skipping any number occupied by any of the enumerated values with 
// a manually assigned value. These values are only used by the system to allow 
// the use of relational operators. The user shall not directly use associated 
// integer values but can access them and convert integer values into enumerated 
// values by using the predefined functions enum2int and int2enum (see clauses 
// 16.1.2, C.1.29 C.1.30 and C.1.4 C.1.4).

module NegSem_060204_enumerated_type_and_values_004 {

    type component GeneralComp {
	}
    
    type enumerated EDays {
        Monday, Tuesday, Wednesday, Thursday, Friday
    };
    
    testcase TC_NegSem_060204_enumerated_type_and_values_004() runs on GeneralComp {
        var EDays v_day0 := Monday;
		var integer v_int := v_day0;
		setverdict(pass);
	}
	
	control {
		execute(TC_NegSem_060204_enumerated_type_and_values_004());
	}
}
+32 −0
Original line number Diff line number Diff line
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:6.2.4, using enumerated value without implicit or explicit type reference
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// For any instantiation or value reference of an enumerated type, the given 
// type shall be implicitly or explicitly referenced.

module NegSem_060204_enumerated_type_and_values_005 {

    type component GeneralComp {
	}
    
    type enumerated EDays {
        Monday, Tuesday, Wednesday, Thursday, Friday
    };
    
    testcase TC_NegSem_060204_enumerated_type_and_values_005() runs on GeneralComp {
        if (Tuesday != Wednesday) { // no implicit or explicit reference to enumeration
		    setverdict(pass);
        } else {
            setverdict(fail);
        }
	}
	
	control {
		execute(TC_NegSem_060204_enumerated_type_and_values_005());
	}
}
Loading