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 {
10 type record R { integer f1 optional }
11 type record RC { charstring f1 optional }
12 type record RU { universal charstring f1 optional }
14 const R cr0 := { omit }
17 const RC crc0 := { omit }
18 const RC crc1 := { "Hello" }
20 const RU cru0 := { omit }
21 const RU cru1 := { char(0,0,78,202) & char(0,0,101,229) & char(0,0,48,111) }
25 var charstring c := "A";
26 var universal charstring u := char(1,2,3,4);
31 // basic test of assignment operators
39 // from constant's field
41 r2.f1 := r2.f1; // self-assign
45 rc.f1 := rc.f1; // self-assign
49 ru.f1 := ru.f1; // self-assign
52 // assignment between charstring and universal charstring
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) { }
72 if (r1.f1 == r2.f1) { }
73 if (r1.f1 != r2.f1) { }
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) { }
84 if (rc.f1 == u[0]) { }
85 if (rc.f1 != u[0]) { }
86 if (u[0] == rc.f1) { }
87 if (u[0] != rc.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) { }
102 if (rc.f1 == ru.f1) { }
103 if (rc.f1 != ru.f1) { }
104 if (ru.f1 == rc.f1) { }
105 if (ru.f1 != rc.f1) { }