conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 15_templates / 1506_referencing_elements_of_templates_or_template_fields / 150605_Referencing_union_alternatives / NegSem_150605_Referencing_union_alternatives_004.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Adrien Kirjak – initial implementation
10 *
11 ** @version 0.0.1
12 ** @purpose 1:15.6.5, Ensure that template variables does not allow referencing alternatives inside an union with complemented list
13 ** @verdict pass reject
14 *****************************************************************/
15
16 //Restriction a)
17 /*referencing an alternative of a union template
18 or template field to which Omit, AnyValueOrNone, a template list or a complemented list is assigned, at the right hand side of an assignment, shall cause an error.*/
19
20
21 module NegSem_150605_Referencing_union_alternatives_004 {
22
23 type union My_Union {
24 integer u1,
25 float u2
26 }
27
28 type record ExampleType { // Exampletype record with union
29 integer a,
30 My_Union b optional
31 }
32
33 type component GeneralComp { }
34
35 testcase TC_NegSem_150605_Referencing_union_alternatives_004() runs on GeneralComp {
36
37 var template ExampleType m_template;
38 var template integer m_template_2;
39
40 //assign values to template:
41
42 m_template.a:=10;
43 m_template.b.u1:=complement(1,2);
44 //m_template.b.u2:=2.0;
45
46 m_template_2 := m_template.b.u1; //error: complement value list
47
48 setverdict(pass);
49
50 }
51
52 control{
53 execute(TC_NegSem_150605_Referencing_union_alternatives_004());
54 }
55 }
This page took 0.038759 seconds and 5 git commands to generate.