conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 06_types_and_values / 0602_structured_types_and_values / 060201_record_type_and_values / 06020101_referencing_fields_of_record_type / Sem_06020101_ReferencingRecordFields_016.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:6.2.1.1, verify that referencing fields nested deep inside omitted record invokes expansion
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 // The following requirement is tested:
17 // When referencing a field of an uninitialized record value or field or omitted field
18 // (including omitting a field at a higher level of the embedding hierarchy) on the left
19 // hand side of an assignment, the reference shall recursively be expanded up to and
20 // including the depth of the referenced subfield as follows:
21 // a) When expanding a value or value field of record type, the subfield referenced in
22 // the dot notation shall be set to present and all unreferenced mandatory subfields shall
23 // be left uninitialized; when the assignment is used in a scope where the optional
24 // attribute is equal to "explicit omit", all unreferenced optional subfields shall be
25 // left undefined. When the assignment is used in a scope where the optional attribute is
26 // equal to "implicit omit", all unreferenced optional subfields shall be set to omit.
27 // b) Expansion of record of/set of/array, union and set values and intermediate fields
28 // shall follow the rules of item a) in clauses 6.2.3 and 6.2.5.1, and clause 6.2.2.1
29 // correspondingly.
30 // At the end of the expansion, the value at the right hand side of the assignment shall
31 // be assigned to the referenced subfield.
32
33 module Sem_06020101_ReferencingRecordFields_016 {
34
35 type component GeneralComp {
36 }
37
38 type record R {
39 record {
40 record {
41 record {
42 integer nested1,
43 integer nested2
44 } subfield1,
45 integer subfield2
46 } field1,
47 charstring field2
48 } sub optional
49 }
50
51 testcase TC_Sem_06020101_ReferencingRecordFields_016() runs on GeneralComp {
52 var R v_rec;
53 v_rec.sub := omit;
54 v_rec.sub.field1.subfield1.nested1 := 0;
55 if (isbound(v_rec.sub) and isbound(v_rec.sub.field1) and not isbound(v_rec.sub.field2) and
56 isbound(v_rec.sub.field1.subfield1) and not isbound(v_rec.sub.field1.subfield2) and
57 match(v_rec.sub.field1.subfield1.nested1, 0) and not isbound(v_rec.sub.field1.subfield1.nested2)) {
58 setverdict(pass);
59 } else {
60 setverdict(fail);
61 }
62 }
63
64 control {
65 execute(TC_Sem_06020101_ReferencingRecordFields_016());
66 }
67
68 }
This page took 0.032402 seconds and 5 git commands to generate.