Debian Codegraph @

src/tests/keywords/if-multivalue

raw
1 #
2 # PRE: update if
3 #
4 update {
5 control:Cleartext-Password := 'hello'
6 reply:Filter-Id := 'filter'
7 }
8
9 update request {
10 Tmp-String-0 := 'foo'
11 Tmp-String-0 += 'bar'
12 Tmp-String-0 += 'baz'
13
14 Tmp-String-1 := 'GROUP ADMINISTRATORS'
15 Tmp-String-1 += 'GROUP STUDENTS'
16 Tmp-String-1 += 'GROUP PEONS'
17
18 Tmp-String-2 := 'PEONS'
19 Tmp-String-2 += 'STUDENTS'
20 Tmp-String-2 += 'ADMINISTRATORS'
21
22 Tmp-String-3 := 'no'
23 Tmp-String-3 += 'no'
24 Tmp-String-3 += 'yes'
25
26 Tmp-Integer-0 := 1
27 Tmp-Integer-0 += 2
28 Tmp-Integer-0 += 5
29 }
30
31 update control {
32 Tmp-String-0 := 'foo'
33 Tmp-String-0 += 'bar'
34 Tmp-String-0 += 'baz'
35
36 Tmp-String-1 := 'boink'
37 Tmp-String-1 += 'tard'
38 Tmp-String-1 += 'dink'
39 Tmp-String-1 += 'slink'
40
41 Tmp-Integer-0 := 01
42 Tmp-Integer-0 += 02
43 Tmp-Integer-0 += 05
44 Tmp-Integer-0 += 04
45
46 Tmp-Integer-1 := 10
47 Tmp-Integer-1 += 20
48 Tmp-Integer-1 += 30
49 }
50
51 #
52 # Mmmm O(N^2)
53 #
54 if (&request:Tmp-String-0[*] != &control:Tmp-String-0[*]) {
55 update reply {
56 Filter-Id += 'fail 0'
57 }
58 }
59
60 if (&request:Tmp-String-0[*] == &control:Tmp-String-1[*]) {
61 update reply {
62 Filter-Id += 'fail 1'
63 }
64 }
65
66 if (&request:Tmp-String-1[*] == &control:Tmp-String-0[*]) {
67 update reply {
68 Filter-Id += 'fail 2'
69 }
70 }
71
72 #
73 # Integer comparison and normalisation
74 #
75 if (&request:Tmp-Integer-0 != &control:Tmp-Integer-0) {
76 update reply {
77 Filter-Id += 'fail 3'
78 }
79 }
80
81 #
82 # if any value of request:Tmp-Integer-0 > any value of
83 # request:Tmp-Integer-1 then evaluate to true
84 #
85 if (&request:Tmp-Integer-0[*] > &control:Tmp-Integer-1[*]) {
86 update reply {
87 Filter-Id += 'fail 4'
88 }
89 }
90
91 #
92 # Compiled regex comparisons
93 #
94 if (&request:Tmp-String-1[*] !~ /PEONS$/) {
95 update reply {
96 Filter-Id += 'fail 5'
97 }
98 }
99
100 if (&control:Tmp-String-1 =~ /PEONS$/) {
101 update reply {
102 Filter-Id += 'fail 6'
103 }
104 }
105
106 if (&control:Tmp-String-1 =~ /DINKS$/) {
107 update reply {
108 Filter-Id += 'fail 7'
109 }
110 }
111
112 #
113 # Dynamic regex comparisons
114 #
115 if (&request:Tmp-String-1[*] !~ /%{Tmp-String-2[0]}$/) {
116 update reply {
117 Filter-Id += 'fail 8'
118 }
119 }
120
121 if (&request:Tmp-String-1 =~ /%{Tmp-String-2[1]}$/) {
122 update reply {
123 Filter-Id += 'fail 9'
124 }
125 }
126
127 if (&request:Tmp-String-1 !~ /%{Tmp-String-2[2]}$/) {
128 update reply {
129 Filter-Id += 'fail 10'
130 }
131 }
132
133 if (&request:Tmp-String-1 =~ /%{Tmp-String-2[#]}$/) {
134 update reply {
135 Filter-Id += 'fail 11'
136 }
137 }
138
139 #
140 # XLAT virtual comparisons
141 #
142 if (&control:Tmp-Integer-0[*] != "%{control:Tmp-Integer-0[#]}") {
143 update reply {
144 Filter-Id += 'fail 12'
145 }
146 }
147
148 #
149 # Literal comparisons
150 #
151 if (&control:Tmp-String-1[*] != 'boink') {
152 update reply {
153 Filter-Id += 'fail 13'
154 }
155 }
156
157 if (&control:Tmp-String-1[*] == 'foo') {
158 update reply {
159 Filter-Id += 'fail 14'
160 }
161 }
162
163 if (&request:Tmp-Integer-0[*] > 10) {
164 update reply {
165 Filter-Id += 'fail 15'
166 }
167 }
168
169 if (!(&request:Tmp-Integer-0[*] < 10)) {
170 update reply {
171 Filter-Id += 'fail 16'
172 }
173 }