adlint 1.10.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/ChangeLog +197 -4
  2. data/MANIFEST +17 -0
  3. data/NEWS +23 -4
  4. data/etc/mesg.d/en_US/messages.yml +14 -1
  5. data/etc/mesg.d/ja_JP/messages.yml +14 -1
  6. data/features/message_detection/W0093.feature +87 -0
  7. data/features/message_detection/W0687.feature +25 -0
  8. data/features/message_detection/W0688.feature +63 -0
  9. data/features/message_detection/W0689.feature +46 -0
  10. data/features/message_detection/W0690.feature +35 -0
  11. data/features/message_detection/W0698.feature +3 -2
  12. data/features/message_detection/W0703.feature +1 -0
  13. data/features/message_detection/W0723.feature +34 -0
  14. data/features/message_detection/W0732.feature +158 -0
  15. data/features/message_detection/W0733.feature +158 -0
  16. data/features/message_detection/W0734.feature +322 -0
  17. data/features/message_detection/W0735.feature +322 -0
  18. data/features/message_detection/W1052.feature +66 -0
  19. data/features/message_detection/W9001.feature +33 -0
  20. data/features/message_detection/W9003.feature +131 -0
  21. data/lib/adlint/c/ctrlexpr.rb +51 -50
  22. data/lib/adlint/c/domain.rb +237 -223
  23. data/lib/adlint/c/expr.rb +6 -8
  24. data/lib/adlint/c/interp.rb +8 -11
  25. data/lib/adlint/c/message.rb +20 -0
  26. data/lib/adlint/c/message_shima.rb +63 -0
  27. data/lib/adlint/c/object.rb +5 -4
  28. data/lib/adlint/c/operator.rb +99 -0
  29. data/lib/adlint/c/parser.rb +2 -2
  30. data/lib/adlint/c/parser.y +2 -2
  31. data/lib/adlint/c/phase.rb +6 -1
  32. data/lib/adlint/c/syntax.rb +442 -30
  33. data/lib/adlint/c/type.rb +449 -363
  34. data/lib/adlint/c/value.rb +96 -25
  35. data/lib/adlint/c.rb +1 -0
  36. data/lib/adlint/prelude.rb +16 -18
  37. data/lib/adlint/version.rb +2 -2
  38. data/share/doc/developers_guide_ja.html +11 -5
  39. data/share/doc/developers_guide_ja.texi +9 -3
  40. data/share/doc/users_guide_en.html +697 -131
  41. data/share/doc/users_guide_en.texi +491 -41
  42. data/share/doc/users_guide_ja.html +709 -139
  43. data/share/doc/users_guide_ja.texi +499 -45
  44. data/spec/adlint/c/ctrlexpr_spec.rb +168 -0
  45. data/spec/adlint/c/domain_spec.rb +835 -0
  46. data/spec/adlint/c/operator_spec.rb +406 -0
  47. data/spec/adlint/c/syntax_spec.rb +717 -0
  48. data/spec/adlint/c/type_spec.rb +55 -30
  49. metadata +19 -2
@@ -0,0 +1,406 @@
1
+ # Unit specification of operator of controlling expressions.
2
+ #
3
+ # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
+ # Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
5
+ # License:: GPLv3+: GNU General Public License version 3 or later
6
+ #
7
+ # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
8
+
9
+ #--
10
+ # ___ ____ __ ___ _________
11
+ # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
+ # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
+ # / __ |/ /_/ / /___/ / /| / / /
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
15
+ #
16
+ # This file is part of AdLint.
17
+ #
18
+ # AdLint is free software: you can redistribute it and/or modify it under the
19
+ # terms of the GNU General Public License as published by the Free Software
20
+ # Foundation, either version 3 of the License, or (at your option) any later
21
+ # version.
22
+ #
23
+ # AdLint is distributed in the hope that it will be useful, but WITHOUT ANY
24
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
25
+ # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
26
+ #
27
+ # You should have received a copy of the GNU General Public License along with
28
+ # AdLint. If not, see <http://www.gnu.org/licenses/>.
29
+ #
30
+ #++
31
+
32
+ require "spec_helper"
33
+
34
+ module AdLint
35
+ module C
36
+
37
+ describe Operator do
38
+ context "Operator" do
39
+ subject { Operator }
40
+
41
+ it "=== Operator::EQ should be true" do
42
+ (subject === Operator::EQ).should be_true
43
+ end
44
+
45
+ it "=== Operator::NE should be true" do
46
+ (subject === Operator::NE).should be_true
47
+ end
48
+
49
+ it "=== Operator::LT should be true" do
50
+ (subject === Operator::LT).should be_true
51
+ end
52
+
53
+ it "=== Operator::GT should be true" do
54
+ (subject === Operator::GT).should be_true
55
+ end
56
+
57
+ it "=== Operator::LE should be true" do
58
+ (subject === Operator::LE).should be_true
59
+ end
60
+
61
+ it "=== Operator::GE should be true" do
62
+ (subject === Operator::GE).should be_true
63
+ end
64
+ end
65
+
66
+ context "Operator::EQ" do
67
+ subject { Operator::EQ }
68
+
69
+ it "=== `==' should be true" do
70
+ (subject === ComparisonOperator.new(:==)).should be_true
71
+ end
72
+
73
+ it "=== `!=' should not be true" do
74
+ (subject === ComparisonOperator.new(:!=)).should_not be_true
75
+ end
76
+
77
+ it "=== `<' should not be true" do
78
+ (subject === ComparisonOperator.new(:<)).should_not be_true
79
+ end
80
+
81
+ it "=== `>' should not be true" do
82
+ (subject === ComparisonOperator.new(:>)).should_not be_true
83
+ end
84
+
85
+ it "=== `<=' should not be true" do
86
+ (subject === ComparisonOperator.new(:<=)).should_not be_true
87
+ end
88
+
89
+ it "=== `>=' should not be true" do
90
+ (subject === ComparisonOperator.new(:>=)).should_not be_true
91
+ end
92
+ end
93
+
94
+ context "Operator::NE" do
95
+ subject { Operator::NE }
96
+
97
+ it "=== `==' should not be true" do
98
+ (subject === ComparisonOperator.new(:==)).should_not be_true
99
+ end
100
+
101
+ it "=== `!=' should be true" do
102
+ (subject === ComparisonOperator.new(:!=)).should be_true
103
+ end
104
+
105
+ it "=== `<' should not be true" do
106
+ (subject === ComparisonOperator.new(:<)).should_not be_true
107
+ end
108
+
109
+ it "=== `>' should not be true" do
110
+ (subject === ComparisonOperator.new(:>)).should_not be_true
111
+ end
112
+
113
+ it "=== `<=' should not be true" do
114
+ (subject === ComparisonOperator.new(:<=)).should_not be_true
115
+ end
116
+
117
+ it "=== `>=' should not be true" do
118
+ (subject === ComparisonOperator.new(:>=)).should_not be_true
119
+ end
120
+ end
121
+
122
+ context "Operator::LT" do
123
+ subject { Operator::LT }
124
+
125
+ it "=== `==' should not be true" do
126
+ (subject === ComparisonOperator.new(:==)).should_not be_true
127
+ end
128
+
129
+ it "=== `!=' should not be true" do
130
+ (subject === ComparisonOperator.new(:!=)).should_not be_true
131
+ end
132
+
133
+ it "=== `<' should be true" do
134
+ (subject === ComparisonOperator.new(:<)).should be_true
135
+ end
136
+
137
+ it "=== `>' should not be true" do
138
+ (subject === ComparisonOperator.new(:>)).should_not be_true
139
+ end
140
+
141
+ it "=== `<=' should not be true" do
142
+ (subject === ComparisonOperator.new(:<=)).should_not be_true
143
+ end
144
+
145
+ it "=== `>=' should not be true" do
146
+ (subject === ComparisonOperator.new(:>=)).should_not be_true
147
+ end
148
+ end
149
+
150
+ context "Operator::GT" do
151
+ subject { Operator::GT }
152
+
153
+ it "=== `==' should not be true" do
154
+ (subject === ComparisonOperator.new(:==)).should_not be_true
155
+ end
156
+
157
+ it "=== `!=' should not be true" do
158
+ (subject === ComparisonOperator.new(:!=)).should_not be_true
159
+ end
160
+
161
+ it "=== `<' should not be true" do
162
+ (subject === ComparisonOperator.new(:<)).should_not be_true
163
+ end
164
+
165
+ it "=== `>' should be true" do
166
+ (subject === ComparisonOperator.new(:>)).should be_true
167
+ end
168
+
169
+ it "=== `<=' should not be true" do
170
+ (subject === ComparisonOperator.new(:<=)).should_not be_true
171
+ end
172
+
173
+ it "=== `>=' should not be true" do
174
+ (subject === ComparisonOperator.new(:>=)).should_not be_true
175
+ end
176
+ end
177
+
178
+ context "Operator::LE" do
179
+ subject { Operator::LE }
180
+
181
+ it "=== `==' should not be true" do
182
+ (subject === ComparisonOperator.new(:==)).should_not be_true
183
+ end
184
+
185
+ it "=== `!=' should not be true" do
186
+ (subject === ComparisonOperator.new(:!=)).should_not be_true
187
+ end
188
+
189
+ it "=== `<' should not be true" do
190
+ (subject === ComparisonOperator.new(:<)).should_not be_true
191
+ end
192
+
193
+ it "=== `>' should not be true" do
194
+ (subject === ComparisonOperator.new(:>)).should_not be_true
195
+ end
196
+
197
+ it "=== `<=' should be true" do
198
+ (subject === ComparisonOperator.new(:<=)).should be_true
199
+ end
200
+
201
+ it "=== `>=' should not be true" do
202
+ (subject === ComparisonOperator.new(:>=)).should_not be_true
203
+ end
204
+ end
205
+
206
+ context "Operator::GE" do
207
+ subject { Operator::GE }
208
+
209
+ it "=== `==' should not be true" do
210
+ (subject === ComparisonOperator.new(:==)).should_not be_true
211
+ end
212
+
213
+ it "=== `!=' should not be true" do
214
+ (subject === ComparisonOperator.new(:!=)).should_not be_true
215
+ end
216
+
217
+ it "=== `<' should not be true" do
218
+ (subject === ComparisonOperator.new(:<)).should_not be_true
219
+ end
220
+
221
+ it "=== `>' should not be true" do
222
+ (subject === ComparisonOperator.new(:>)).should_not be_true
223
+ end
224
+
225
+ it "=== `<=' should not be true" do
226
+ (subject === ComparisonOperator.new(:<=)).should_not be_true
227
+ end
228
+
229
+ it "=== `>=' should be true" do
230
+ (subject === ComparisonOperator.new(:>=)).should be_true
231
+ end
232
+ end
233
+
234
+ describe ComparisonOperator do
235
+ context "`=='" do
236
+ subject { ComparisonOperator.new(:==) }
237
+
238
+ it "=== Operator::EQ should be true" do
239
+ (subject === Operator::EQ).should be_true
240
+ end
241
+
242
+ it "=== Operator::NE should not be true" do
243
+ (subject === Operator::NE).should_not be_true
244
+ end
245
+
246
+ it "=== Operator::LT should not be true" do
247
+ (subject === Operator::LT).should_not be_true
248
+ end
249
+
250
+ it "=== Operator::GT should not be true" do
251
+ (subject === Operator::GT).should_not be_true
252
+ end
253
+
254
+ it "=== Operator::LE should not be true" do
255
+ (subject === Operator::LE).should_not be_true
256
+ end
257
+
258
+ it "=== Operator::GE should not be true" do
259
+ (subject === Operator::GE).should_not be_true
260
+ end
261
+ end
262
+
263
+ context "`!='" do
264
+ subject { ComparisonOperator.new(:!=) }
265
+
266
+ it "=== Operator::EQ should not be true" do
267
+ (subject === Operator::EQ).should_not be_true
268
+ end
269
+
270
+ it "=== Operator::NE should be true" do
271
+ (subject === Operator::NE).should be_true
272
+ end
273
+
274
+ it "=== Operator::LT should not be true" do
275
+ (subject === Operator::LT).should_not be_true
276
+ end
277
+
278
+ it "=== Operator::GT should not be true" do
279
+ (subject === Operator::GT).should_not be_true
280
+ end
281
+
282
+ it "=== Operator::LE should not be true" do
283
+ (subject === Operator::LE).should_not be_true
284
+ end
285
+
286
+ it "=== Operator::GE should not be true" do
287
+ (subject === Operator::GE).should_not be_true
288
+ end
289
+ end
290
+
291
+ context "`<'" do
292
+ subject { ComparisonOperator.new(:<) }
293
+
294
+ it "=== Operator::EQ should not be true" do
295
+ (subject === Operator::EQ).should_not be_true
296
+ end
297
+
298
+ it "=== Operator::NE should not be true" do
299
+ (subject === Operator::NE).should_not be_true
300
+ end
301
+
302
+ it "=== Operator::LT should be true" do
303
+ (subject === Operator::LT).should be_true
304
+ end
305
+
306
+ it "=== Operator::GT should not be true" do
307
+ (subject === Operator::GT).should_not be_true
308
+ end
309
+
310
+ it "=== Operator::LE should not be true" do
311
+ (subject === Operator::LE).should_not be_true
312
+ end
313
+
314
+ it "=== Operator::GE should not be true" do
315
+ (subject === Operator::GE).should_not be_true
316
+ end
317
+ end
318
+
319
+ context "`>'" do
320
+ subject { ComparisonOperator.new(:>) }
321
+
322
+ it "=== Operator::EQ should not be true" do
323
+ (subject === Operator::EQ).should_not be_true
324
+ end
325
+
326
+ it "=== Operator::NE should not be true" do
327
+ (subject === Operator::NE).should_not be_true
328
+ end
329
+
330
+ it "=== Operator::LT should not be true" do
331
+ (subject === Operator::LT).should_not be_true
332
+ end
333
+
334
+ it "=== Operator::GT should be true" do
335
+ (subject === Operator::GT).should be_true
336
+ end
337
+
338
+ it "=== Operator::LE should not be true" do
339
+ (subject === Operator::LE).should_not be_true
340
+ end
341
+
342
+ it "=== Operator::GE should not be true" do
343
+ (subject === Operator::GE).should_not be_true
344
+ end
345
+ end
346
+
347
+ context "`<='" do
348
+ subject { ComparisonOperator.new(:<=) }
349
+
350
+ it "=== Operator::EQ should not be true" do
351
+ (subject === Operator::EQ).should_not be_true
352
+ end
353
+
354
+ it "=== Operator::NE should not be true" do
355
+ (subject === Operator::NE).should_not be_true
356
+ end
357
+
358
+ it "=== Operator::LT should not be true" do
359
+ (subject === Operator::LT).should_not be_true
360
+ end
361
+
362
+ it "=== Operator::GT should not be true" do
363
+ (subject === Operator::GT).should_not be_true
364
+ end
365
+
366
+ it "=== Operator::LE should be true" do
367
+ (subject === Operator::LE).should be_true
368
+ end
369
+
370
+ it "=== Operator::GE should not be true" do
371
+ (subject === Operator::GE).should_not be_true
372
+ end
373
+ end
374
+
375
+ context "`>='" do
376
+ subject { ComparisonOperator.new(:>=) }
377
+
378
+ it "=== Operator::EQ should not be true" do
379
+ (subject === Operator::EQ).should_not be_true
380
+ end
381
+
382
+ it "=== Operator::NE should not be true" do
383
+ (subject === Operator::NE).should_not be_true
384
+ end
385
+
386
+ it "=== Operator::LT should not be true" do
387
+ (subject === Operator::LT).should_not be_true
388
+ end
389
+
390
+ it "=== Operator::GT should not be true" do
391
+ (subject === Operator::GT).should_not be_true
392
+ end
393
+
394
+ it "=== Operator::LE should not be true" do
395
+ (subject === Operator::LE).should_not be_true
396
+ end
397
+
398
+ it "=== Operator::GE should be true" do
399
+ (subject === Operator::GE).should be_true
400
+ end
401
+ end
402
+ end
403
+ end
404
+
405
+ end
406
+ end