Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / compileonly / optionalAssignCompare / ToptionalAssignCompare.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2015 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 module ToptionalAssignCompare {
9
10 type record R { integer f1 optional }
11 type record RC { charstring f1 optional }
12 type record RU { universal charstring f1 optional }
13
14 const R cr0 := { omit }
15 const R cr1 := { 17 }
16
17 const RC crc0 := { omit }
18 const RC crc1 := { "Hello" }
19
20 const RU cru0 := { omit }
21 const RU cru1 := { char(0,0,78,202) & char(0,0,101,229) & char(0,0,48,111) }
22
23 control {
24 var integer i := 1;
25 var charstring c := "A";
26 var universal charstring u := char(1,2,3,4);
27 var R r1, r2;
28 var RC rc;
29 var RU ru;
30
31 // basic test of assignment operators
32 r1.f1 := omit;
33 r2.f1 := r1.f1;
34 r1.f1 := 0;
35 r2.f1 := r1.f1;
36 r1.f1 := i;
37 r2.f1 := r1.f1;
38
39 // from constant's field
40 r2.f1 := cr0.f1;
41 r2.f1 := r2.f1; // self-assign
42 r2.f1 := cr1.f1;
43
44 rc.f1 := crc0.f1;
45 rc.f1 := rc.f1; // self-assign
46 rc.f1 := crc1.f1;
47
48 ru.f1 := cru0.f1
49 ru.f1 := ru.f1; // self-assign
50 ru.f1 := cru1.f1
51
52 // assignment between charstring and universal charstring
53 rc.f1 := c[0];
54 ru.f1 := c;
55 ru.f1 := rc.f1;
56 ru.f1 := c[0];
57 ru.f1 := u[0];
58
59 // basic test of comparison operators
60 if (r1.f1 == omit) { }
61 if (r1.f1 != omit) { }
62 if (omit == r1.f1) { }
63 if (omit != r1.f1) { }
64 if (0 == r1.f1) { }
65 if (0 != r1.f1) { }
66 if (r1.f1 == 0) { }
67 if (r1.f1 != 0) { }
68 if (i == r1.f1) { }
69 if (i != r1.f1) { }
70 if (r1.f1 == i) { }
71 if (r1.f1 != i) { }
72 if (r1.f1 == r2.f1) { }
73 if (r1.f1 != r2.f1) { }
74
75 // comparison between charstring and universal charstring
76 if (rc.f1 == c[0]) { }
77 if (rc.f1 != c[0]) { }
78 if (c[0] == rc.f1) { }
79 if (c[0] != rc.f1) { }
80 if (rc.f1 == u) { }
81 if (rc.f1 != u) { }
82 if (u == rc.f1) { }
83 if (u != rc.f1) { }
84 if (rc.f1 == u[0]) { }
85 if (rc.f1 != u[0]) { }
86 if (u[0] == rc.f1) { }
87 if (u[0] != rc.f1) { }
88
89 if (ru.f1 == c) { }
90 if (ru.f1 != c) { }
91 if (c == ru.f1) { }
92 if (c != ru.f1) { }
93 if (ru.f1 == c[0]) { }
94 if (ru.f1 != c[0]) { }
95 if (c[0] == ru.f1) { }
96 if (c[0] != ru.f1) { }
97 if (ru.f1 == u[0]) { }
98 if (ru.f1 != u[0]) { }
99 if (u[0] == ru.f1) { }
100 if (u[0] != ru.f1) { }
101
102 if (rc.f1 == ru.f1) { }
103 if (rc.f1 != ru.f1) { }
104 if (ru.f1 == rc.f1) { }
105 if (ru.f1 != rc.f1) { }
106 }
107
108 }
This page took 0.034474 seconds and 5 git commands to generate.