adlint 2.6.14 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (401) hide show
  1. data/AUTHORS +1 -3
  2. data/ChangeLog +511 -0
  3. data/INSTALL +1 -1
  4. data/MANIFEST +57 -37
  5. data/NEWS +36 -7
  6. data/README +2 -2
  7. data/Rakefile +6 -6
  8. data/TODO +1 -1
  9. data/bin/adlint +25 -16
  10. data/bin/adlint_chk +22 -12
  11. data/bin/adlint_cma +17 -12
  12. data/bin/adlint_sma +22 -12
  13. data/bin/adlintize +98 -17
  14. data/etc/conf.d/fallback/cinit.erb +1 -1
  15. data/etc/conf.d/fallback/traits.erb +37 -37
  16. data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +1 -1
  17. data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +41 -41
  18. data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +1 -1
  19. data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +40 -40
  20. data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +1 -1
  21. data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +40 -40
  22. data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +1 -1
  23. data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +40 -40
  24. data/etc/conf.d/noarch/GNUmakefile.erb +1 -1
  25. data/etc/conf.d/noarch/adlint_all_bat.erb +1 -1
  26. data/etc/conf.d/noarch/adlint_all_sh.erb +1 -1
  27. data/etc/conf.d/noarch/pinit.erb +1 -1
  28. data/etc/conf.d/x86_64-ubuntu_12.04/cinit-gcc_4.6.3.erb +1 -1
  29. data/etc/conf.d/x86_64-ubuntu_12.04/traits-gcc_4.6.3.erb +42 -42
  30. data/etc/mesg.d/c_builtin/en_US/messages.yml +33 -33
  31. data/etc/mesg.d/c_builtin/ja_JP/messages.yml +5 -5
  32. data/etc/mesg.d/core/en_US/messages.yml +2 -2
  33. data/etc/mesg.d/core/ja_JP/messages.yml +2 -2
  34. data/features/code_check/W0018.feature +197 -0
  35. data/features/code_check/W0019.feature +79 -0
  36. data/features/code_check/W0021.feature +81 -0
  37. data/features/code_check/W0023.feature +203 -0
  38. data/features/code_check/W0024.feature +226 -0
  39. data/features/code_check/W0025.feature +5 -0
  40. data/features/code_check/W0088.feature +2 -2
  41. data/features/code_check/W0109.feature +2 -2
  42. data/features/code_check/W0477.feature +0 -3
  43. data/features/code_check/W0478.feature +0 -1
  44. data/features/code_check/W0582.feature +3 -3
  45. data/features/code_check/W0583.feature +4 -7
  46. data/features/code_check/W0646.feature +0 -1
  47. data/features/code_check/W0695.feature +0 -1
  48. data/features/code_check/W0705.feature +8 -0
  49. data/features/code_check/W0723.feature +0 -1
  50. data/features/code_check/W0745.feature +1 -0
  51. data/features/code_check/W0781.feature +1 -0
  52. data/features/code_check/W1057.feature +141 -0
  53. data/features/code_check/W1058.feature +93 -0
  54. data/features/code_check/W1059.feature +86 -0
  55. data/features/code_check/W1060.feature +77 -0
  56. data/features/code_check/W1061.feature +143 -0
  57. data/features/code_check/W1062.feature +162 -0
  58. data/features/code_check/W1063.feature +123 -0
  59. data/features/code_check/W1064.feature +83 -0
  60. data/features/code_check/W1065.feature +82 -0
  61. data/features/code_check/W9003.feature +2 -0
  62. data/features/step_definitions/code_check_steps.rb +1 -0
  63. data/features/support/env.rb +16 -13
  64. data/lib/adlint.rb +7 -4
  65. data/lib/adlint/analyzer.rb +131 -157
  66. data/lib/adlint/annot.rb +149 -0
  67. data/lib/adlint/cc1.rb +57 -0
  68. data/lib/adlint/{c → cc1}/branch.rb +74 -62
  69. data/lib/adlint/{c → cc1}/builtin.rb +21 -21
  70. data/lib/adlint/{c → cc1}/const.rb +119 -117
  71. data/lib/adlint/{c → cc1}/conv.rb +76 -78
  72. data/lib/adlint/{c → cc1}/ctrlexpr.rb +69 -86
  73. data/lib/adlint/cc1/domain.rb +8103 -0
  74. data/lib/adlint/{c → cc1}/enum.rb +3 -3
  75. data/lib/adlint/{c → cc1}/environ.rb +21 -21
  76. data/lib/adlint/{c → cc1}/expr.rb +232 -218
  77. data/lib/adlint/{c → cc1}/format.rb +305 -342
  78. data/lib/adlint/{c → cc1}/interp.rb +269 -220
  79. data/lib/adlint/cc1/lexer.rb +246 -0
  80. data/lib/adlint/{c → cc1}/mediator.rb +78 -84
  81. data/lib/adlint/{c → cc1}/object.rb +261 -264
  82. data/lib/adlint/{c → cc1}/operator.rb +7 -7
  83. data/lib/adlint/{c → cc1}/option.rb +4 -3
  84. data/lib/adlint/{c → cc1}/parser.rb +274 -506
  85. data/lib/adlint/{c → cc1}/parser.y +69 -301
  86. data/lib/adlint/cc1/phase.rb +138 -0
  87. data/lib/adlint/{c → cc1}/resolver.rb +66 -78
  88. data/lib/adlint/{c → cc1}/scanner.rb +57 -49
  89. data/lib/adlint/{c → cc1}/scope.rb +3 -3
  90. data/lib/adlint/{c → cc1}/seqp.rb +13 -5
  91. data/lib/adlint/{c → cc1}/syntax.rb +819 -1122
  92. data/lib/adlint/{c → cc1}/type.rb +1498 -1479
  93. data/lib/adlint/{c → cc1}/util.rb +20 -12
  94. data/lib/adlint/{c → cc1}/value.rb +699 -642
  95. data/lib/adlint/code.rb +163 -164
  96. data/lib/adlint/cpp.rb +2 -2
  97. data/lib/adlint/cpp/asm.rb +13 -14
  98. data/lib/adlint/cpp/constexpr.rb +42 -38
  99. data/lib/adlint/cpp/constexpr.y +44 -40
  100. data/lib/adlint/cpp/eval.rb +435 -435
  101. data/lib/adlint/cpp/lexer.rb +343 -340
  102. data/lib/adlint/cpp/macro.rb +188 -190
  103. data/lib/adlint/cpp/phase.rb +66 -45
  104. data/lib/adlint/cpp/scanner.rb +14 -17
  105. data/lib/adlint/cpp/source.rb +49 -55
  106. data/lib/adlint/cpp/subst.rb +65 -65
  107. data/lib/adlint/cpp/syntax.rb +155 -275
  108. data/lib/adlint/cpp/util.rb +22 -19
  109. data/lib/adlint/driver.rb +86 -93
  110. data/lib/adlint/error.rb +33 -52
  111. data/lib/adlint/exam.rb +158 -24
  112. data/lib/adlint/exam/c_builtin.rb +7 -7
  113. data/lib/adlint/exam/c_builtin/cc1_check.rb +20522 -0
  114. data/lib/adlint/exam/c_builtin/cc1_check_shima.rb +957 -0
  115. data/lib/adlint/exam/c_builtin/cc1_code.rb +459 -0
  116. data/lib/adlint/exam/c_builtin/cc1_metric.rb +794 -0
  117. data/lib/adlint/exam/c_builtin/cpp_check.rb +486 -441
  118. data/lib/adlint/exam/c_builtin/cpp_check_shima.rb +36 -39
  119. data/lib/adlint/exam/c_builtin/cpp_code.rb +63 -65
  120. data/lib/adlint/exam/c_builtin/ld_check.rb +136 -129
  121. data/lib/adlint/exam/c_builtin/ld_metric.rb +11 -11
  122. data/lib/adlint/lang.rb +25 -25
  123. data/lib/adlint/ld.rb +2 -2
  124. data/lib/adlint/ld/object.rb +220 -188
  125. data/lib/adlint/ld/phase.rb +94 -63
  126. data/lib/adlint/ld/typedef.rb +22 -11
  127. data/lib/adlint/ld/util.rb +43 -35
  128. data/lib/adlint/lexer.rb +59 -56
  129. data/lib/adlint/location.rb +140 -0
  130. data/lib/adlint/memo.rb +157 -0
  131. data/lib/adlint/message.rb +207 -156
  132. data/lib/adlint/metric.rb +139 -217
  133. data/lib/adlint/monitor.rb +45 -43
  134. data/lib/adlint/phase.rb +56 -29
  135. data/lib/adlint/prelude.rb +66 -54
  136. data/lib/adlint/report.rb +253 -332
  137. data/lib/adlint/source.rb +26 -27
  138. data/lib/adlint/supp.rb +131 -0
  139. data/lib/adlint/symbol.rb +14 -16
  140. data/lib/adlint/token.rb +19 -91
  141. data/lib/adlint/traits.rb +242 -226
  142. data/lib/adlint/util.rb +116 -205
  143. data/lib/adlint/version.rb +8 -8
  144. data/share/HEADER +2 -2
  145. data/share/doc/developers_guide_ja.html +148 -19
  146. data/share/doc/developers_guide_ja.texi +141 -11
  147. data/share/doc/samples/GNUmakefile +1 -1
  148. data/share/doc/samples/adlint_traits.yml +45 -36
  149. data/share/doc/users_guide_en.html +1321 -1252
  150. data/share/doc/users_guide_en.texi +475 -408
  151. data/share/doc/users_guide_ja.html +1932 -1878
  152. data/share/doc/users_guide_ja.texi +324 -273
  153. data/share/sample/bison-2.5/adlint/GNUmakefile +5 -1
  154. data/share/sample/bison-2.5/adlint/adlint_traits.yml +38 -38
  155. data/share/sample/bison-2.5/adlint/lib/GNUmakefile +1 -1
  156. data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +1 -1
  157. data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +1 -1
  158. data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +50 -42
  159. data/share/sample/bison-2.5/adlint/src/GNUmakefile +1 -1
  160. data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +1 -1
  161. data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +1 -1
  162. data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +50 -42
  163. data/share/sample/ctags-5.8/adlint/GNUmakefile +1 -1
  164. data/share/sample/ctags-5.8/adlint/adlint_cinit.h +1 -1
  165. data/share/sample/ctags-5.8/adlint/adlint_pinit.h +1 -1
  166. data/share/sample/ctags-5.8/adlint/adlint_traits.yml +50 -42
  167. data/share/sample/flex-2.5.35/adlint/GNUmakefile +1 -1
  168. data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +1 -1
  169. data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +1 -1
  170. data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +50 -42
  171. data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +1 -1
  172. data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +46 -38
  173. data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +1 -1
  174. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +1 -1
  175. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +1 -1
  176. data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +50 -42
  177. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +1 -1
  178. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +1 -1
  179. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +1 -1
  180. data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +50 -42
  181. data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +1 -1
  182. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +1 -1
  183. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +1 -1
  184. data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +50 -42
  185. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +1 -1
  186. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +1 -1
  187. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +1 -1
  188. data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +50 -42
  189. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +1 -1
  190. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +1 -1
  191. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +1 -1
  192. data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +50 -42
  193. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +1 -1
  194. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +1 -1
  195. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +1 -1
  196. data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +50 -42
  197. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +1 -1
  198. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +1 -1
  199. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +1 -1
  200. data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +50 -42
  201. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +1 -1
  202. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +1 -1
  203. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +1 -1
  204. data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +50 -42
  205. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +1 -1
  206. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +1 -1
  207. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +1 -1
  208. data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +50 -42
  209. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +1 -1
  210. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +1 -1
  211. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +1 -1
  212. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +50 -42
  213. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +1 -1
  214. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +1 -1
  215. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +1 -1
  216. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +50 -42
  217. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +1 -1
  218. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +1 -1
  219. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +1 -1
  220. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +50 -42
  221. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +1 -1
  222. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +1 -1
  223. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +1 -1
  224. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +50 -42
  225. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +1 -1
  226. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +1 -1
  227. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +1 -1
  228. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +50 -42
  229. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +1 -1
  230. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +1 -1
  231. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +1 -1
  232. data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +50 -42
  233. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +1 -1
  234. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +1 -1
  235. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +1 -1
  236. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +50 -42
  237. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +1 -1
  238. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +1 -1
  239. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +1 -1
  240. data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +50 -42
  241. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +1 -1
  242. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +1 -1
  243. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +1 -1
  244. data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +50 -42
  245. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +1 -1
  246. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +1 -1
  247. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +1 -1
  248. data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +50 -42
  249. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +1 -1
  250. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +1 -1
  251. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +1 -1
  252. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +50 -42
  253. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +1 -1
  254. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +1 -1
  255. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +1 -1
  256. data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +50 -42
  257. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +1 -1
  258. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +1 -1
  259. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +1 -1
  260. data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +50 -42
  261. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +1 -1
  262. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +1 -1
  263. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +1 -1
  264. data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +50 -42
  265. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +1 -1
  266. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +1 -1
  267. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +1 -1
  268. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +50 -42
  269. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +1 -1
  270. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +1 -1
  271. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +1 -1
  272. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +50 -42
  273. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +1 -1
  274. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +1 -1
  275. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +1 -1
  276. data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +50 -42
  277. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +1 -1
  278. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +1 -1
  279. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +1 -1
  280. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +50 -42
  281. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +1 -1
  282. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +1 -1
  283. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +1 -1
  284. data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +50 -42
  285. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +1 -1
  286. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +1 -1
  287. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +1 -1
  288. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +50 -42
  289. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +1 -1
  290. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +1 -1
  291. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +1 -1
  292. data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +50 -42
  293. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +1 -1
  294. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +1 -1
  295. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +1 -1
  296. data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +50 -42
  297. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +1 -1
  298. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +1 -1
  299. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +1 -1
  300. data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +50 -42
  301. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +1 -1
  302. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +1 -1
  303. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +1 -1
  304. data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +50 -42
  305. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +1 -1
  306. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +1 -1
  307. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +1 -1
  308. data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +50 -42
  309. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +1 -1
  310. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +1 -1
  311. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +1 -1
  312. data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +50 -42
  313. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +1 -1
  314. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +1 -1
  315. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +1 -1
  316. data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +50 -42
  317. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +1 -1
  318. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +1 -1
  319. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +1 -1
  320. data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +50 -42
  321. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +1 -1
  322. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +1 -1
  323. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +1 -1
  324. data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +50 -42
  325. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +1 -1
  326. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +1 -1
  327. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +1 -1
  328. data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +50 -42
  329. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +1 -1
  330. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +1 -1
  331. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +1 -1
  332. data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +50 -42
  333. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +1 -1
  334. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +1 -1
  335. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +1 -1
  336. data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +50 -42
  337. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +1 -1
  338. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +1 -1
  339. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +1 -1
  340. data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +50 -42
  341. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +1 -1
  342. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +1 -1
  343. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +1 -1
  344. data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +50 -42
  345. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +1 -1
  346. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +1 -1
  347. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +1 -1
  348. data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +50 -42
  349. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +1 -1
  350. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +1 -1
  351. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +1 -1
  352. data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +50 -42
  353. data/share/sample/screen-4.0.3/adlint/GNUmakefile +1 -1
  354. data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +1 -1
  355. data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +1 -1
  356. data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +50 -42
  357. data/share/sample/vim-7.3/adlint/vim/GNUmakefile +1 -1
  358. data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +1 -1
  359. data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +1 -1
  360. data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +50 -42
  361. data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +1 -1
  362. data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +1 -1
  363. data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +1 -1
  364. data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +49 -41
  365. data/share/sample/zsh-4.3.15/adlint/GNUmakefile +1 -1
  366. data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +46 -38
  367. data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +1 -1
  368. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +1 -1
  369. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +1 -1
  370. data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +50 -42
  371. data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +1 -1
  372. data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +1 -1
  373. data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +1 -1
  374. data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +50 -42
  375. data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +1 -1
  376. data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +1 -1
  377. data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +1 -1
  378. data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +50 -42
  379. data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +1 -1
  380. data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +1 -1
  381. data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +1 -1
  382. data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +50 -42
  383. data/spec/adlint/{c → cc1}/ctrlexpr_spec.rb +51 -49
  384. data/spec/adlint/{c → cc1}/domain_spec.rb +210 -179
  385. data/spec/adlint/{c → cc1}/operator_spec.rb +3 -3
  386. data/spec/adlint/{c → cc1}/syntax_spec.rb +10 -12
  387. data/spec/adlint/{c → cc1}/type_spec.rb +61 -68
  388. data/{lib/adlint/c.rb → spec/adlint/location_spec.rb} +24 -29
  389. data/spec/conf.d/default_traits.yml +38 -37
  390. data/spec/conf.d/empty_cinit.h +1 -1
  391. data/spec/conf.d/empty_pinit.h +1 -1
  392. data/spec/conf.d/project/foo.c +0 -0
  393. data/spec/spec_helper.rb +2 -2
  394. metadata +60 -40
  395. data/lib/adlint/c/domain.rb +0 -7931
  396. data/lib/adlint/c/lexer.rb +0 -252
  397. data/lib/adlint/c/phase.rb +0 -135
  398. data/lib/adlint/exam/c_builtin/c_check.rb +0 -20745
  399. data/lib/adlint/exam/c_builtin/c_check_shima.rb +0 -983
  400. data/lib/adlint/exam/c_builtin/c_code.rb +0 -477
  401. data/lib/adlint/exam/c_builtin/c_metric.rb +0 -818
@@ -2,7 +2,7 @@
2
2
  # iteration-statements.
3
3
  #
4
4
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
5
- # Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
5
+ # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
6
6
  # License:: GPLv3+: GNU General Public License version 3 or later
7
7
  #
8
8
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -12,7 +12,7 @@
12
12
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
13
13
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
14
14
  # / __ |/ /_/ / /___/ / /| / / /
15
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
15
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
16
16
  #
17
17
  # This file is part of AdLint.
18
18
  #
@@ -33,45 +33,49 @@
33
33
  require "spec_helper"
34
34
 
35
35
  module AdLint
36
- module C
36
+ module Cc1
37
37
 
38
38
  describe ControllingExpression do
39
- before(:all) { Traits.instance.read_from($default_traits) }
39
+ include InterpreterMediator
40
+
41
+ before(:all) { @adlint = AdLint.new($default_traits) }
40
42
 
41
43
  before(:each) do
44
+ @monitor = ProgressMonitor.new(nil, nil, false)
45
+ @logger = Logger.new(File.open(File::NULL, "w"))
42
46
  @symbol_table = SymbolTable.new
43
- @type_table = TypeTable.new
44
- @interpreter = Interpreter.new(@type_table)
45
- @int_i = @interpreter.define_variable(int_i_definition)
46
- @int_j = @interpreter.define_variable(int_j_definition)
47
+ @type_table = TypeTable.new(@adlint.traits, @monitor, @logger)
48
+ @interpreter = Interpreter.new(@type_table)
49
+ @int_i = @interpreter.define_variable(int_i_def)
50
+ @int_j = @interpreter.define_variable(int_j_def)
47
51
  end
48
52
 
49
53
  context "`int i = ((> 0) && (< 10)) || (== 0)' and " +
50
54
  "`int j = ((> 0) && (< 10)) || (== 0)'" do
51
55
  before do
52
- @int_i.narrow_value_domain!(Operator::GE, ScalarValue.of(0))
53
- @int_i.narrow_value_domain!(Operator::LT, ScalarValue.of(10))
54
- @int_j.narrow_value_domain!(Operator::GE, ScalarValue.of(0))
55
- @int_j.narrow_value_domain!(Operator::LT, ScalarValue.of(10))
56
+ @int_i.narrow_value_domain!(Operator::GE, scalar_value_of(0))
57
+ @int_i.narrow_value_domain!(Operator::LT, scalar_value_of(10))
58
+ @int_j.narrow_value_domain!(Operator::GE, scalar_value_of(0))
59
+ @int_j.narrow_value_domain!(Operator::LT, scalar_value_of(10))
56
60
  end
57
61
 
58
62
  it "(i == j) makes that `i' should contain 0 and 9, " +
59
63
  "and should not contain 10" do
60
- expr = EqualityExpression.new(eq_operator, i_specifier, j_specifier)
64
+ expr = EqualityExpression.new(eq_op, i_spec, j_spec)
61
65
  branched_eval(expr, NARROWING, FINAL) do
62
- @int_i.value.may_be_equal_to?(ScalarValue.of(0)).should be_true
63
- @int_i.value.may_be_equal_to?(ScalarValue.of(9)).should be_true
64
- @int_i.value.may_be_equal_to?(ScalarValue.of(10)).should_not be_true
66
+ @int_i.value.may_be_equal_to?(scalar_value_of(0)).should be_true
67
+ @int_i.value.may_be_equal_to?(scalar_value_of(9)).should be_true
68
+ @int_i.value.may_be_equal_to?(scalar_value_of(10)).should_not be_true
65
69
  end
66
70
  end
67
71
 
68
72
  it "(i != j) makes that `i' should contain 0 and 9, " +
69
73
  "and should not contain 10" do
70
- expr = EqualityExpression.new(ne_operator, i_specifier, j_specifier)
74
+ expr = EqualityExpression.new(ne_op, i_spec, j_spec)
71
75
  branched_eval(expr, NARROWING, FINAL) do
72
- @int_i.value.may_be_equal_to?(ScalarValue.of(0)).should be_true
73
- @int_i.value.may_be_equal_to?(ScalarValue.of(9)).should be_true
74
- @int_i.value.may_be_equal_to?(ScalarValue.of(10)).should_not be_true
76
+ @int_i.value.may_be_equal_to?(scalar_value_of(0)).should be_true
77
+ @int_i.value.may_be_equal_to?(scalar_value_of(9)).should be_true
78
+ @int_i.value.may_be_equal_to?(scalar_value_of(10)).should_not be_true
75
79
  end
76
80
  end
77
81
  end
@@ -79,73 +83,71 @@ module C
79
83
  context "`int i = ((> 0) && (< 10)) || (== 0)' and " +
80
84
  "`int j = ((> 3) && (< 5)) || (== 3)'" do
81
85
  before do
82
- @int_i.narrow_value_domain!(Operator::GE, ScalarValue.of(0))
83
- @int_i.narrow_value_domain!(Operator::LT, ScalarValue.of(10))
84
- @int_j.narrow_value_domain!(Operator::GE, ScalarValue.of(3))
85
- @int_j.narrow_value_domain!(Operator::LT, ScalarValue.of(5))
86
+ @int_i.narrow_value_domain!(Operator::GE, scalar_value_of(0))
87
+ @int_i.narrow_value_domain!(Operator::LT, scalar_value_of(10))
88
+ @int_j.narrow_value_domain!(Operator::GE, scalar_value_of(3))
89
+ @int_j.narrow_value_domain!(Operator::LT, scalar_value_of(5))
86
90
  end
87
91
 
88
92
  it "(i == j) makes that `i' should contain 3 and 4, " +
89
93
  "and should not contain 0" do
90
- expr = EqualityExpression.new(eq_operator, i_specifier, j_specifier)
94
+ expr = EqualityExpression.new(eq_op, i_spec, j_spec)
91
95
  branched_eval(expr, NARROWING, FINAL) do
92
- @int_i.value.may_be_equal_to?(ScalarValue.of(3)).should be_true
93
- @int_i.value.may_be_equal_to?(ScalarValue.of(4)).should be_true
94
- @int_i.value.may_be_equal_to?(ScalarValue.of(0)).should_not be_true
96
+ @int_i.value.may_be_equal_to?(scalar_value_of(3)).should be_true
97
+ @int_i.value.may_be_equal_to?(scalar_value_of(4)).should be_true
98
+ @int_i.value.may_be_equal_to?(scalar_value_of(0)).should_not be_true
95
99
  end
96
100
  end
97
101
  end
98
102
 
99
- include InterpreterMediator
100
-
101
103
  private
102
- def eq_operator
104
+ def eq_op
103
105
  Token.new("==", "==", nil_loc)
104
106
  end
105
107
 
106
- def ne_operator
108
+ def ne_op
107
109
  Token.new("!=", "!=", nil_loc)
108
110
  end
109
111
 
110
- def i_specifier
111
- object_specifier_of("i")
112
+ def i_spec
113
+ obj_spec_of("i")
112
114
  end
113
115
 
114
- def j_specifier
115
- object_specifier_of("j")
116
+ def j_spec
117
+ obj_spec_of("j")
116
118
  end
117
119
 
118
- def object_specifier_of(name)
119
- ObjectSpecifier.new(identifier_of(name))
120
+ def obj_spec_of(name)
121
+ ObjectSpecifier.new(id_of(name))
120
122
  end
121
123
 
122
- def int_i_definition
123
- uninitialized_int_vardef("i", @type_table.int_type)
124
+ def int_i_def
125
+ uninitialized_int_vardef("i", @type_table.int_t)
124
126
  end
125
127
 
126
- def int_j_definition
127
- uninitialized_int_vardef("j", @type_table.int_type)
128
+ def int_j_def
129
+ uninitialized_int_vardef("j", @type_table.int_t)
128
130
  end
129
131
 
130
132
  def uninitialized_int_vardef(name, type)
131
- decl_specs = DeclarationSpecifiers.new.tap { |ds|
132
- ds.type_specifiers.push(int_type_specifier)
133
+ dcl_specs = DeclarationSpecifiers.new.tap { |ds|
134
+ ds.type_specifiers.push(int_t_spec)
133
135
  }
134
- decl = Declaration.new(decl_specs, [uninitialized_int_decl(name)],
136
+ decl = Declaration.new(dcl_specs, [uninitialized_int_dcl(name)],
135
137
  @symbol_table)
136
138
  decl.items.each { |item| item.type = type }
137
139
  decl.items.find { |item| item.kind_of?(VariableDefinition) }
138
140
  end
139
141
 
140
- def uninitialized_int_decl(name)
141
- InitDeclarator.new(IdentifierDeclarator.new(identifier_of(name)), nil)
142
+ def uninitialized_int_dcl(name)
143
+ InitDeclarator.new(IdentifierDeclarator.new(id_of(name)), nil)
142
144
  end
143
145
 
144
- def int_type_specifier
146
+ def int_t_spec
145
147
  StandardTypeSpecifier.new(Token.new(:INT, "int", Location.new))
146
148
  end
147
149
 
148
- def identifier_of(name)
150
+ def id_of(name)
149
151
  Token.new(:IDENTIFIER, name, nil_loc)
150
152
  end
151
153
 
@@ -1,7 +1,7 @@
1
1
  # Unit specification of domain of values bound to variables.
2
2
  #
3
3
  # Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
4
- # Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
4
+ # Copyright:: Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
5
5
  # License:: GPLv3+: GNU General Public License version 3 or later
6
6
  #
7
7
  # Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
@@ -11,7 +11,7 @@
11
11
  # / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
12
12
  # / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
13
13
  # / __ |/ /_/ / /___/ / /| / / /
14
- # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
14
+ # /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2013, OGIS-RI Co.,Ltd.
15
15
  #
16
16
  # This file is part of AdLint.
17
17
  #
@@ -32,173 +32,177 @@
32
32
  require "spec_helper"
33
33
 
34
34
  module AdLint
35
- module C
35
+ module Cc1
36
36
 
37
37
  describe ValueDomain do
38
+ include ArithmeticAccessor
39
+
40
+ before(:all) { @adlint = AdLint.new($default_traits) }
41
+
38
42
  describe EqualToValueDomain do
39
43
  context "(== -2147483648)" do
40
- subject { ValueDomain.equal_to(-2147483648) }
44
+ subject { value_domain_equal_to(-2147483648) }
41
45
 
42
46
  it "should contain (== -2147483648)" do
43
- subject.contain?(ValueDomain.equal_to(-2147483648)).should be_true
47
+ subject.contain?(value_domain_equal_to(-2147483648)).should be_true
44
48
  end
45
49
 
46
50
  it "should not contain (== 2147483647)" do
47
- subject.contain?(ValueDomain.equal_to(2147483647)).should be_false
51
+ subject.contain?(value_domain_equal_to(2147483647)).should be_false
48
52
  end
49
53
  end
50
54
 
51
55
  context "(== 2147483647)" do
52
- subject { ValueDomain.equal_to(2147483647) }
56
+ subject { value_domain_equal_to(2147483647) }
53
57
 
54
58
  it "should not contain (== -2147483648)" do
55
- subject.contain?(ValueDomain.equal_to(-2147483648)).should be_false
59
+ subject.contain?(value_domain_equal_to(-2147483648)).should be_false
56
60
  end
57
61
  end
58
62
 
59
63
  context "(== 2)" do
60
- subject { ValueDomain.equal_to(2) }
64
+ subject { value_domain_equal_to(2) }
61
65
 
62
66
  it "* (== 3) should be (== 6)" do
63
- rhs = ValueDomain.equal_to(3)
67
+ rhs = value_domain_equal_to(3)
64
68
  (subject * rhs).to_s.should == "(== 6)"
65
69
  end
66
70
 
67
71
  it "* (== 0) should be (== 0)" do
68
- rhs = ValueDomain.equal_to(0)
72
+ rhs = value_domain_equal_to(0)
69
73
  (subject * rhs).to_s.should == "(== 0)"
70
74
  end
71
75
 
72
76
  it "* (== -3) should be (== -6)" do
73
- rhs = ValueDomain.equal_to(-3)
77
+ rhs = value_domain_equal_to(-3)
74
78
  (subject * rhs).to_s.should == "(== -6)"
75
79
  end
76
80
 
77
81
  it "* (< 3) should be (< 6)" do
78
- rhs = ValueDomain.less_than(3)
82
+ rhs = value_domain_less_than(3)
79
83
  (subject * rhs).to_s.should == "(< 6)"
80
84
  end
81
85
 
82
86
  it "* (< 0) should be (< 0)" do
83
- rhs = ValueDomain.less_than(0)
87
+ rhs = value_domain_less_than(0)
84
88
  (subject * rhs).to_s.should == "(< 0)"
85
89
  end
86
90
 
87
91
  it "* (< -3) should be (< -6)" do
88
- rhs = ValueDomain.less_than(-3)
92
+ rhs = value_domain_less_than(-3)
89
93
  (subject * rhs).to_s.should == "(< -6)"
90
94
  end
91
95
 
92
96
  it "* (> 3) should be (> 6)" do
93
- rhs = ValueDomain.greater_than(3)
97
+ rhs = value_domain_greater_than(3)
94
98
  (subject * rhs).to_s.should == "(> 6)"
95
99
  end
96
100
 
97
101
  it "* (> 0) should be (> 0)" do
98
- rhs = ValueDomain.greater_than(0)
102
+ rhs = value_domain_greater_than(0)
99
103
  (subject * rhs).to_s.should == "(> 0)"
100
104
  end
101
105
 
102
106
  it "* (> -3) should be (> -6)" do
103
- rhs = ValueDomain.greater_than(-3)
107
+ rhs = value_domain_greater_than(-3)
104
108
  (subject * rhs).to_s.should == "(> -6)"
105
109
  end
106
110
  end
107
111
 
108
112
  context "(== 0)" do
109
- subject { ValueDomain.equal_to(0) }
113
+ subject { value_domain_equal_to(0) }
110
114
 
111
115
  it "* (== 3) should be (== 0)" do
112
- rhs = ValueDomain.equal_to(3)
116
+ rhs = value_domain_equal_to(3)
113
117
  (subject * rhs).to_s.should == "(== 0)"
114
118
  end
115
119
 
116
120
  it "* (== 0) should be (== 0)" do
117
- rhs = ValueDomain.equal_to(0)
121
+ rhs = value_domain_equal_to(0)
118
122
  (subject * rhs).to_s.should == "(== 0)"
119
123
  end
120
124
 
121
125
  it "* (== -3) should be (== 0)" do
122
- rhs = ValueDomain.equal_to(-3)
126
+ rhs = value_domain_equal_to(-3)
123
127
  (subject * rhs).to_s.should == "(== 0)"
124
128
  end
125
129
 
126
130
  it "* (< 3) should be (== 0)" do
127
- rhs = ValueDomain.less_than(3)
131
+ rhs = value_domain_less_than(3)
128
132
  (subject * rhs).to_s.should == "(== 0)"
129
133
  end
130
134
 
131
135
  it "* (< 0) should be (== 0)" do
132
- rhs = ValueDomain.less_than(0)
136
+ rhs = value_domain_less_than(0)
133
137
  (subject * rhs).to_s.should == "(== 0)"
134
138
  end
135
139
 
136
140
  it "* (< -3) should be (== 0)" do
137
- rhs = ValueDomain.less_than(-3)
141
+ rhs = value_domain_less_than(-3)
138
142
  (subject * rhs).to_s.should == "(== 0)"
139
143
  end
140
144
 
141
145
  it "* (> 3) should be (== 0)" do
142
- rhs = ValueDomain.greater_than(3)
146
+ rhs = value_domain_greater_than(3)
143
147
  (subject * rhs).to_s.should == "(== 0)"
144
148
  end
145
149
 
146
150
  it "* (> 0) should be (== 0)" do
147
- rhs = ValueDomain.greater_than(0)
151
+ rhs = value_domain_greater_than(0)
148
152
  (subject * rhs).to_s.should == "(== 0)"
149
153
  end
150
154
 
151
155
  it "* (> -3) should be (== 0)" do
152
- rhs = ValueDomain.greater_than(-3)
156
+ rhs = value_domain_greater_than(-3)
153
157
  (subject * rhs).to_s.should == "(== 0)"
154
158
  end
155
159
  end
156
160
 
157
161
  context "(== -2)" do
158
- subject { ValueDomain.equal_to(-2) }
162
+ subject { value_domain_equal_to(-2) }
159
163
 
160
164
  it "* (== 3) should be (== -6)" do
161
- rhs = ValueDomain.equal_to(3)
165
+ rhs = value_domain_equal_to(3)
162
166
  (subject * rhs).to_s.should == "(== -6)"
163
167
  end
164
168
 
165
169
  it "* (== 0) should be (== 0)" do
166
- rhs = ValueDomain.equal_to(0)
170
+ rhs = value_domain_equal_to(0)
167
171
  (subject * rhs).to_s.should == "(== 0)"
168
172
  end
169
173
 
170
174
  it "* (== -3) should be (== 6)" do
171
- rhs = ValueDomain.equal_to(-3)
175
+ rhs = value_domain_equal_to(-3)
172
176
  (subject * rhs).to_s.should == "(== 6)"
173
177
  end
174
178
 
175
179
  it "* (< 3) should be (> -6)" do
176
- rhs = ValueDomain.less_than(3)
180
+ rhs = value_domain_less_than(3)
177
181
  (subject * rhs).to_s.should == "(> -6)"
178
182
  end
179
183
 
180
184
  it "* (< 0) should be (> 0)" do
181
- rhs = ValueDomain.less_than(0)
185
+ rhs = value_domain_less_than(0)
182
186
  (subject * rhs).to_s.should == "(> 0)"
183
187
  end
184
188
 
185
189
  it "* (< -3) should be (> 6)" do
186
- rhs = ValueDomain.less_than(-3)
190
+ rhs = value_domain_less_than(-3)
187
191
  (subject * rhs).to_s.should == "(> 6)"
188
192
  end
189
193
 
190
194
  it "* (> 3) should be (< -6)" do
191
- rhs = ValueDomain.greater_than(3)
195
+ rhs = value_domain_greater_than(3)
192
196
  (subject * rhs).to_s.should == "(< -6)"
193
197
  end
194
198
 
195
199
  it "* (> 0) should be (< 0)" do
196
- rhs = ValueDomain.greater_than(0)
200
+ rhs = value_domain_greater_than(0)
197
201
  (subject * rhs).to_s.should == "(< 0)"
198
202
  end
199
203
 
200
204
  it "* (> -3) should be (< 6)" do
201
- rhs = ValueDomain.greater_than(-3)
205
+ rhs = value_domain_greater_than(-3)
202
206
  (subject * rhs).to_s.should == "(< 6)"
203
207
  end
204
208
  end
@@ -206,157 +210,157 @@ module C
206
210
 
207
211
  describe LessThanValueDomain do
208
212
  context "(< 128)" do
209
- subject { ValueDomain.less_than(128) }
213
+ subject { value_domain_less_than(128) }
210
214
 
211
215
  it "< (== 127) should be (== Unlimited)" do
212
- rhs = ValueDomain.equal_to(127)
216
+ rhs = value_domain_equal_to(127)
213
217
  (subject < rhs).to_s.should == "(== Unlimited)"
214
218
  end
215
219
  end
216
220
 
217
221
  context "(< 2)" do
218
- subject { ValueDomain.less_than(2) }
222
+ subject { value_domain_less_than(2) }
219
223
 
220
224
  it "* (== 3) should be (< 6)" do
221
- rhs = ValueDomain.equal_to(3)
225
+ rhs = value_domain_equal_to(3)
222
226
  (subject * rhs).to_s.should == "(< 6)"
223
227
  end
224
228
 
225
229
  it "* (== 0) should be (== 0)" do
226
- rhs = ValueDomain.equal_to(0)
230
+ rhs = value_domain_equal_to(0)
227
231
  (subject * rhs).to_s.should == "(== 0)"
228
232
  end
229
233
 
230
234
  it "* (== -3) should be (> -6)" do
231
- rhs = ValueDomain.equal_to(-3)
235
+ rhs = value_domain_equal_to(-3)
232
236
  (subject * rhs).to_s.should == "(> -6)"
233
237
  end
234
238
 
235
239
  it "* (< 3) should be (== Unlimited)" do
236
- rhs = ValueDomain.less_than(3)
240
+ rhs = value_domain_less_than(3)
237
241
  (subject * rhs).to_s.should == "(== Unlimited)"
238
242
  end
239
243
 
240
244
  it "* (< 0) should be (== Unlimited)" do
241
- rhs = ValueDomain.less_than(0)
245
+ rhs = value_domain_less_than(0)
242
246
  (subject * rhs).to_s.should == "(== Unlimited)"
243
247
  end
244
248
 
245
249
  it "* (< -3) should be (== Unlimited)" do
246
- rhs = ValueDomain.less_than(-3)
250
+ rhs = value_domain_less_than(-3)
247
251
  (subject * rhs).to_s.should == "(== Unlimited)"
248
252
  end
249
253
 
250
254
  it "* (> 3) should be (== Unlimited)" do
251
- rhs = ValueDomain.greater_than(3)
255
+ rhs = value_domain_greater_than(3)
252
256
  (subject * rhs).to_s.should == "(== Unlimited)"
253
257
  end
254
258
 
255
259
  it "* (> 0) should be (== Unlimited)" do
256
- rhs = ValueDomain.greater_than(0)
260
+ rhs = value_domain_greater_than(0)
257
261
  (subject * rhs).to_s.should == "(== Unlimited)"
258
262
  end
259
263
 
260
264
  it "* (> -3) should be (== Unlimited)" do
261
- rhs = ValueDomain.greater_than(-3)
265
+ rhs = value_domain_greater_than(-3)
262
266
  (subject * rhs).to_s.should == "(== Unlimited)"
263
267
  end
264
268
  end
265
269
 
266
270
  context "(< 0)" do
267
- subject { ValueDomain.less_than(0) }
271
+ subject { value_domain_less_than(0) }
268
272
 
269
273
  it "* (== 3) should be (< 0)" do
270
- rhs = ValueDomain.equal_to(3)
274
+ rhs = value_domain_equal_to(3)
271
275
  (subject * rhs).to_s.should == "(< 0)"
272
276
  end
273
277
 
274
278
  it "* (== 0) should be (== 0)" do
275
- rhs = ValueDomain.equal_to(0)
279
+ rhs = value_domain_equal_to(0)
276
280
  (subject * rhs).to_s.should == "(== 0)"
277
281
  end
278
282
 
279
283
  it "* (== -3) should be (> 0)" do
280
- rhs = ValueDomain.equal_to(-3)
284
+ rhs = value_domain_equal_to(-3)
281
285
  (subject * rhs).to_s.should == "(> 0)"
282
286
  end
283
287
 
284
288
  it "* (< 3) should be (== Unlimited)" do
285
- rhs = ValueDomain.less_than(3)
289
+ rhs = value_domain_less_than(3)
286
290
  (subject * rhs).to_s.should == "(== Unlimited)"
287
291
  end
288
292
 
289
293
  it "* (< 0) should be (> 0)" do
290
- rhs = ValueDomain.less_than(0)
294
+ rhs = value_domain_less_than(0)
291
295
  (subject * rhs).to_s.should == "(> 0)"
292
296
  end
293
297
 
294
298
  it "* (< -3) should be (> 0)" do
295
- rhs = ValueDomain.less_than(-3)
299
+ rhs = value_domain_less_than(-3)
296
300
  (subject * rhs).to_s.should == "(> 0)"
297
301
  end
298
302
 
299
303
  it "* (> 3) should be (< 0)" do
300
- rhs = ValueDomain.greater_than(3)
304
+ rhs = value_domain_greater_than(3)
301
305
  (subject * rhs).to_s.should == "(< 0)"
302
306
  end
303
307
 
304
308
  it "* (> 0) should be (< 0)" do
305
- rhs = ValueDomain.greater_than(0)
309
+ rhs = value_domain_greater_than(0)
306
310
  (subject * rhs).to_s.should == "(< 0)"
307
311
  end
308
312
 
309
313
  it "* (> -3) should be (== Unlimited)" do
310
- rhs = ValueDomain.greater_than(-3)
314
+ rhs = value_domain_greater_than(-3)
311
315
  (subject * rhs).to_s.should == "(== Unlimited)"
312
316
  end
313
317
  end
314
318
 
315
319
  context "(< -2)" do
316
- subject { ValueDomain.less_than(-2) }
320
+ subject { value_domain_less_than(-2) }
317
321
 
318
322
  it "* (== 3) should be (< -6)" do
319
- rhs = ValueDomain.equal_to(3)
323
+ rhs = value_domain_equal_to(3)
320
324
  (subject * rhs).to_s.should == "(< -6)"
321
325
  end
322
326
 
323
327
  it "* (== 0) should be (== 0)" do
324
- rhs = ValueDomain.equal_to(0)
328
+ rhs = value_domain_equal_to(0)
325
329
  (subject * rhs).to_s.should == "(== 0)"
326
330
  end
327
331
 
328
332
  it "* (== -3) should be (> 6)" do
329
- rhs = ValueDomain.equal_to(-3)
333
+ rhs = value_domain_equal_to(-3)
330
334
  (subject * rhs).to_s.should == "(> 6)"
331
335
  end
332
336
 
333
337
  it "* (< 3) should be (== Unlimited)" do
334
- rhs = ValueDomain.less_than(3)
338
+ rhs = value_domain_less_than(3)
335
339
  (subject * rhs).to_s.should == "(== Unlimited)"
336
340
  end
337
341
 
338
342
  it "* (< 0) should be (> 0)" do
339
- rhs = ValueDomain.less_than(0)
343
+ rhs = value_domain_less_than(0)
340
344
  (subject * rhs).to_s.should == "(> 0)"
341
345
  end
342
346
 
343
347
  it "* (< -3) should be (> 6)" do
344
- rhs = ValueDomain.less_than(-3)
348
+ rhs = value_domain_less_than(-3)
345
349
  (subject * rhs).to_s.should == "(> 6)"
346
350
  end
347
351
 
348
352
  it "* (> 3) should be (< -6)" do
349
- rhs = ValueDomain.greater_than(3)
353
+ rhs = value_domain_greater_than(3)
350
354
  (subject * rhs).to_s.should == "(< -6)"
351
355
  end
352
356
 
353
357
  it "* (> 0) should be (< 0)" do
354
- rhs = ValueDomain.greater_than(0)
358
+ rhs = value_domain_greater_than(0)
355
359
  (subject * rhs).to_s.should == "(< 0)"
356
360
  end
357
361
 
358
362
  it "* (> -3) should be (== Unlimited)" do
359
- rhs = ValueDomain.greater_than(-3)
363
+ rhs = value_domain_greater_than(-3)
360
364
  (subject * rhs).to_s.should == "(== Unlimited)"
361
365
  end
362
366
  end
@@ -364,157 +368,157 @@ module C
364
368
 
365
369
  describe GreaterThanValueDomain do
366
370
  context "(> -129)" do
367
- subject { ValueDomain.greater_than(-129) }
371
+ subject { value_domain_greater_than(-129) }
368
372
 
369
373
  it "< (== 127) should be (== Unlimited)" do
370
- rhs = ValueDomain.equal_to(127)
374
+ rhs = value_domain_equal_to(127)
371
375
  (subject < rhs).to_s.should == "(== Unlimited)"
372
376
  end
373
377
  end
374
378
 
375
379
  context "(> 2)" do
376
- subject { ValueDomain.greater_than(2) }
380
+ subject { value_domain_greater_than(2) }
377
381
 
378
382
  it "* (== 3) should be (> 6)" do
379
- rhs = ValueDomain.equal_to(3)
383
+ rhs = value_domain_equal_to(3)
380
384
  (subject * rhs).to_s.should == "(> 6)"
381
385
  end
382
386
 
383
387
  it "* (== 0) should be (== 0)" do
384
- rhs = ValueDomain.equal_to(0)
388
+ rhs = value_domain_equal_to(0)
385
389
  (subject * rhs).to_s.should == "(== 0)"
386
390
  end
387
391
 
388
392
  it "* (== -3) should be (< -6)" do
389
- rhs = ValueDomain.equal_to(-3)
393
+ rhs = value_domain_equal_to(-3)
390
394
  (subject * rhs).to_s.should == "(< -6)"
391
395
  end
392
396
 
393
397
  it "* (< 3) should be (== Unlimited)" do
394
- rhs = ValueDomain.less_than(3)
398
+ rhs = value_domain_less_than(3)
395
399
  (subject * rhs).to_s.should == "(== Unlimited)"
396
400
  end
397
401
 
398
402
  it "* (< 0) should be (< 0)" do
399
- rhs = ValueDomain.less_than(0)
403
+ rhs = value_domain_less_than(0)
400
404
  (subject * rhs).to_s.should == "(< 0)"
401
405
  end
402
406
 
403
407
  it "* (< -3) should be (< -6)" do
404
- rhs = ValueDomain.less_than(-3)
408
+ rhs = value_domain_less_than(-3)
405
409
  (subject * rhs).to_s.should == "(< -6)"
406
410
  end
407
411
 
408
412
  it "* (> 3) should be (> 6)" do
409
- rhs = ValueDomain.greater_than(3)
413
+ rhs = value_domain_greater_than(3)
410
414
  (subject * rhs).to_s.should == "(> 6)"
411
415
  end
412
416
 
413
417
  it "* (> 0) should be (> 0)" do
414
- rhs = ValueDomain.greater_than(0)
418
+ rhs = value_domain_greater_than(0)
415
419
  (subject * rhs).to_s.should == "(> 0)"
416
420
  end
417
421
 
418
422
  it "* (> -3) should be (== Unlimited)" do
419
- rhs = ValueDomain.greater_than(-3)
423
+ rhs = value_domain_greater_than(-3)
420
424
  (subject * rhs).to_s.should == "(== Unlimited)"
421
425
  end
422
426
  end
423
427
 
424
428
  context "(> 0)" do
425
- subject { ValueDomain.greater_than(0) }
429
+ subject { value_domain_greater_than(0) }
426
430
 
427
431
  it "* (== 3) should be (> 0)" do
428
- rhs = ValueDomain.equal_to(3)
432
+ rhs = value_domain_equal_to(3)
429
433
  (subject * rhs).to_s.should == "(> 0)"
430
434
  end
431
435
 
432
436
  it "* (== 0) should be (== 0)" do
433
- rhs = ValueDomain.equal_to(0)
437
+ rhs = value_domain_equal_to(0)
434
438
  (subject * rhs).to_s.should == "(== 0)"
435
439
  end
436
440
 
437
441
  it "* (== -3) should be (< 0)" do
438
- rhs = ValueDomain.equal_to(-3)
442
+ rhs = value_domain_equal_to(-3)
439
443
  (subject * rhs).to_s.should == "(< 0)"
440
444
  end
441
445
 
442
446
  it "* (< 3) should be (== Unlimited)" do
443
- rhs = ValueDomain.less_than(3)
447
+ rhs = value_domain_less_than(3)
444
448
  (subject * rhs).to_s.should == "(== Unlimited)"
445
449
  end
446
450
 
447
451
  it "* (< 0) should be (< 0)" do
448
- rhs = ValueDomain.less_than(0)
452
+ rhs = value_domain_less_than(0)
449
453
  (subject * rhs).to_s.should == "(< 0)"
450
454
  end
451
455
 
452
456
  it "* (< -3) should be (< 0)" do
453
- rhs = ValueDomain.less_than(-3)
457
+ rhs = value_domain_less_than(-3)
454
458
  (subject * rhs).to_s.should == "(< 0)"
455
459
  end
456
460
 
457
461
  it "* (> 3) should be (> 0)" do
458
- rhs = ValueDomain.greater_than(3)
462
+ rhs = value_domain_greater_than(3)
459
463
  (subject * rhs).to_s.should == "(> 0)"
460
464
  end
461
465
 
462
466
  it "* (> 0) should be (> 0)" do
463
- rhs = ValueDomain.greater_than(0)
467
+ rhs = value_domain_greater_than(0)
464
468
  (subject * rhs).to_s.should == "(> 0)"
465
469
  end
466
470
 
467
471
  it "* (> -3) should be (== Unlimited)" do
468
- rhs = ValueDomain.greater_than(-3)
472
+ rhs = value_domain_greater_than(-3)
469
473
  (subject * rhs).to_s.should == "(== Unlimited)"
470
474
  end
471
475
  end
472
476
 
473
477
  context "(> -2)" do
474
- subject { ValueDomain.greater_than(-2) }
478
+ subject { value_domain_greater_than(-2) }
475
479
 
476
480
  it "* (== 3) should be (> -6)" do
477
- rhs = ValueDomain.equal_to(3)
481
+ rhs = value_domain_equal_to(3)
478
482
  (subject * rhs).to_s.should == "(> -6)"
479
483
  end
480
484
 
481
485
  it "* (== 0) should be (== 0)" do
482
- rhs = ValueDomain.equal_to(0)
486
+ rhs = value_domain_equal_to(0)
483
487
  (subject * rhs).to_s.should == "(== 0)"
484
488
  end
485
489
 
486
490
  it "* (== -3) should be (< 6)" do
487
- rhs = ValueDomain.equal_to(-3)
491
+ rhs = value_domain_equal_to(-3)
488
492
  (subject * rhs).to_s.should == "(< 6)"
489
493
  end
490
494
 
491
495
  it "* (< 3) should be (== Unlimited)" do
492
- rhs = ValueDomain.less_than(3)
496
+ rhs = value_domain_less_than(3)
493
497
  (subject * rhs).to_s.should == "(== Unlimited)"
494
498
  end
495
499
 
496
500
  it "* (< 0) should be (== Unlimited)" do
497
- rhs = ValueDomain.less_than(0)
501
+ rhs = value_domain_less_than(0)
498
502
  (subject * rhs).to_s.should == "(== Unlimited)"
499
503
  end
500
504
 
501
505
  it "* (< -3) should be (== Unlimited)" do
502
- rhs = ValueDomain.less_than(-3)
506
+ rhs = value_domain_less_than(-3)
503
507
  (subject * rhs).to_s.should == "(== Unlimited)"
504
508
  end
505
509
 
506
510
  it "* (> 3) should be (== Unlimited)" do
507
- rhs = ValueDomain.greater_than(3)
511
+ rhs = value_domain_greater_than(3)
508
512
  (subject * rhs).to_s.should == "(== Unlimited)"
509
513
  end
510
514
 
511
515
  it "* (> 0) should be (== Unlimited)" do
512
- rhs = ValueDomain.greater_than(0)
516
+ rhs = value_domain_greater_than(0)
513
517
  (subject * rhs).to_s.should == "(== Unlimited)"
514
518
  end
515
519
 
516
520
  it "* (> -3) should be (== Unlimited)" do
517
- rhs = ValueDomain.greater_than(-3)
521
+ rhs = value_domain_greater_than(-3)
518
522
  (subject * rhs).to_s.should == "(== Unlimited)"
519
523
  end
520
524
  end
@@ -523,86 +527,86 @@ module C
523
527
  describe CompositeValueDomain do
524
528
  context "(== (((< 10) || (== 10)) && ((== -10) || (> -10))))" do
525
529
  subject do
526
- tmp = ValueDomain.greater_than_or_equal_to(-10)
527
- tmp.intersection(ValueDomain.less_than_or_equal_to(10))
530
+ tmp = value_domain_greater_than_or_equal_to(-10)
531
+ tmp.intersection(value_domain_less_than_or_equal_to(10))
528
532
  end
529
533
 
530
534
  it "should contain ((== -5) || (== 5))" do
531
- rhs = ValueDomain.equal_to(-5).union(ValueDomain.equal_to(5))
535
+ rhs = value_domain_equal_to(-5).union(value_domain_equal_to(5))
532
536
  subject.contain?(rhs).should be_true
533
537
  end
534
538
  end
535
539
 
536
540
  context "((== -5) || (== 5))" do
537
- subject { ValueDomain.equal_to(-5).union(ValueDomain.equal_to(5)) }
541
+ subject { value_domain_equal_to(-5).union(value_domain_equal_to(5)) }
538
542
 
539
543
  it "should not contain " +
540
544
  "(((< 10) || (== 10)) && ((== -10) || (> -10)))" do
541
- rhs = ValueDomain.greater_than_or_equal_to(-10)
542
- rhs = rhs.intersection(ValueDomain.less_than_or_equal_to(10))
545
+ rhs = value_domain_greater_than_or_equal_to(-10)
546
+ rhs = rhs.intersection(value_domain_less_than_or_equal_to(10))
543
547
  subject.contain?(rhs).should be_false
544
548
  end
545
549
 
546
550
  it "should be contained by " +
547
551
  "(((< 10) || (== 10)) && ((== -10) || (> -10)))" do
548
- lhs = ValueDomain.greater_than_or_equal_to(-10)
549
- lhs = lhs.intersection(ValueDomain.less_than_or_equal_to(10))
552
+ lhs = value_domain_greater_than_or_equal_to(-10)
553
+ lhs = lhs.intersection(value_domain_less_than_or_equal_to(10))
550
554
  lhs.contain?(subject).should be_true
551
555
  end
552
556
 
553
557
  it "intersection with (< 0) should be equal to (== -5)" do
554
- rhs = ValueDomain.less_than(0)
558
+ rhs = value_domain_less_than(0)
555
559
  subject.intersection(rhs).to_s.should == "(== -5)"
556
560
  end
557
561
 
558
562
  it "intersection with (> 0) should be equal to (== 5)" do
559
- rhs = ValueDomain.greater_than(0)
563
+ rhs = value_domain_greater_than(0)
560
564
  subject.intersection(rhs).to_s.should == "(== 5)"
561
565
  end
562
566
 
563
567
  it "intersection with ((== -10) || (> -10)) " +
564
568
  "should be equal to the subject domain" do
565
- rhs = ValueDomain.greater_than_or_equal_to(-10)
569
+ rhs = value_domain_greater_than_or_equal_to(-10)
566
570
  subject.intersection(rhs).should == subject
567
571
  end
568
572
 
569
573
  it "intersection with ((== 10) || (< 10)) " +
570
574
  "should be equal to the subject domain" do
571
- rhs = ValueDomain.less_than_or_equal_to(10)
575
+ rhs = value_domain_less_than_or_equal_to(10)
572
576
  subject.intersection(rhs).should == subject
573
577
  end
574
578
 
575
579
  it "should not contain (((< 0) && (> -10)) || (== -10))" do
576
- rhs = ValueDomain.greater_than_or_equal_to(-10)
577
- rhs = rhs.intersection(ValueDomain.less_than_or_equal_to(10))
578
- rhs = rhs.intersection(ValueDomain.less_than(0))
580
+ rhs = value_domain_greater_than_or_equal_to(-10)
581
+ rhs = rhs.intersection(value_domain_less_than_or_equal_to(10))
582
+ rhs = rhs.intersection(value_domain_less_than(0))
579
583
  subject.contain?(rhs).should be_false
580
584
  end
581
585
  end
582
586
 
583
587
  context "(((< 0) && (> -10)) || (== -10))" do
584
588
  subject do
585
- tmp = ValueDomain.greater_than_or_equal_to(-10)
586
- tmp = tmp.intersection(ValueDomain.less_than_or_equal_to(10))
587
- tmp.intersection(ValueDomain.less_than(0))
589
+ tmp = value_domain_greater_than_or_equal_to(-10)
590
+ tmp = tmp.intersection(value_domain_less_than_or_equal_to(10))
591
+ tmp.intersection(value_domain_less_than(0))
588
592
  end
589
593
 
590
594
  it "should not contain ((== -5) || (== 5))" do
591
- rhs = ValueDomain.equal_to(-5).union(ValueDomain.equal_to(5))
595
+ rhs = value_domain_equal_to(-5).union(value_domain_equal_to(5))
592
596
  subject.contain?(rhs).should be_false
593
597
  end
594
598
  end
595
599
 
596
600
  context "(((< 0) && (> -2147483647)) || (== 0))" do
597
601
  subject do
598
- tmp = ValueDomain.less_than_or_equal_to(0)
599
- tmp.intersection(ValueDomain.greater_than_or_equal_to(-2147483647))
602
+ tmp = value_domain_less_than_or_equal_to(0)
603
+ tmp.intersection(value_domain_greater_than_or_equal_to(-2147483647))
600
604
  end
601
605
 
602
606
  it "union with ((== -2147483647) || (== 0)) should be " +
603
607
  "((((< 0) && (> -2147483647)) || (== -2147483647)) || (== 0))" do
604
- rhs = ValueDomain.equal_to(-2147483647)
605
- rhs = rhs.union(ValueDomain.equal_to(0))
608
+ rhs = value_domain_equal_to(-2147483647)
609
+ rhs = rhs.union(value_domain_equal_to(0))
606
610
  subject.union(rhs).to_s.should ==
607
611
  "((((< 0) && (> -2147483647)) || (== -2147483647)) || (== 0))"
608
612
  end
@@ -610,29 +614,29 @@ module C
610
614
 
611
615
  context "((== -2147483647) || (== 0))" do
612
616
  subject do
613
- ValueDomain.equal_to(-2147483647).union(ValueDomain.equal_to(0))
617
+ value_domain_equal_to(-2147483647).union(value_domain_equal_to(0))
614
618
  end
615
619
 
616
620
  it "should contain ((== -2147483647) || (== 0))" do
617
- rhs = ValueDomain.equal_to(-2147483647)
618
- rhs = rhs.union(ValueDomain.equal_to(0))
621
+ rhs = value_domain_equal_to(-2147483647)
622
+ rhs = rhs.union(value_domain_equal_to(0))
619
623
  subject.contain?(rhs).should be_true
620
624
  end
621
625
 
622
626
  it "should contain (== -2147483647)" do
623
- subject.contain?(ValueDomain.equal_to(-2147483647)).should be_true
627
+ subject.contain?(value_domain_equal_to(-2147483647)).should be_true
624
628
  end
625
629
 
626
630
  it "should contain (== 0)" do
627
- subject.contain?(ValueDomain.equal_to(0)).should be_true
631
+ subject.contain?(value_domain_equal_to(0)).should be_true
628
632
  end
629
633
  end
630
634
 
631
635
  context "(((< 2147483647) && (> -2147483648)) || (== 2147483647))" do
632
636
  subject do
633
- tmp = ValueDomain.greater_than(-2147483648)
634
- tmp = tmp.intersection(ValueDomain.less_than(2147483647))
635
- tmp.union(ValueDomain.equal_to(2147483647))
637
+ tmp = value_domain_greater_than(-2147483648)
638
+ tmp = tmp.intersection(value_domain_less_than(2147483647))
639
+ tmp.union(value_domain_equal_to(2147483647))
636
640
  end
637
641
 
638
642
  it "cloned should be " +
@@ -656,15 +660,15 @@ module C
656
660
 
657
661
  context "(((< 2147483647) && (> 1)) || (== 1))" do
658
662
  subject do
659
- tmp = ValueDomain.greater_than(1)
660
- tmp = tmp.intersection(ValueDomain.less_than(2147483647))
661
- tmp.union(ValueDomain.equal_to(1))
663
+ tmp = value_domain_greater_than(1)
664
+ tmp = tmp.intersection(value_domain_less_than(2147483647))
665
+ tmp.union(value_domain_equal_to(1))
662
666
  end
663
667
 
664
668
  it "union with ((== 1) || (== 2147483647)) should be " +
665
669
  "(((< 2147483647) && (> 1)) || ((== 1) || (== 2147483647)))" do
666
- rhs = ValueDomain.equal_to(1)
667
- rhs = rhs.union(ValueDomain.equal_to(2147483647))
670
+ rhs = value_domain_equal_to(1)
671
+ rhs = rhs.union(value_domain_equal_to(2147483647))
668
672
  subject.union(rhs).to_s.should ==
669
673
  "(((< 2147483647) && (> 1)) || ((== 1) || (== 2147483647)))"
670
674
  end
@@ -672,21 +676,23 @@ module C
672
676
 
673
677
  context "(((< 429) && (> 0)) || (== 429))" do
674
678
  subject do
675
- tmp = ValueDomain.greater_than(0)
676
- tmp = tmp.intersection(ValueDomain.less_than(429))
677
- tmp.union(ValueDomain.equal_to(429))
679
+ tmp = value_domain_greater_than(0)
680
+ tmp = tmp.intersection(value_domain_less_than(429))
681
+ tmp.union(value_domain_equal_to(429))
678
682
  end
679
683
 
680
684
  it "intersection with (== 0) should be (== Nil)" do
681
- subject.intersection(ValueDomain.equal_to(0)).to_s.should ==
685
+ subject.intersection(value_domain_equal_to(0)).to_s.should ==
682
686
  "(== Nil)"
683
687
  end
684
688
  end
685
689
 
686
690
  context "(((< 10) || (== 10)) && ((== 0) || (> 0)))" do
687
691
  subject do
688
- ValueDomain.of_intersection(ValueDomain.greater_than_or_equal_to(0),
689
- ValueDomain.less_than_or_equal_to(10))
692
+ ValueDomain.of_intersection(
693
+ value_domain_greater_than_or_equal_to(0),
694
+ value_domain_less_than_or_equal_to(10)
695
+ )
690
696
  end
691
697
 
692
698
  it "+ (((< 10) || (== 10)) && ((== 0) || (> 0))) " +
@@ -698,53 +704,53 @@ module C
698
704
 
699
705
  context "((((< 10) && (> -10)) || (== 10)) || (== -10))" do
700
706
  subject do
701
- tmp = ValueDomain.greater_than_or_equal_to(-10)
702
- tmp.intersection(ValueDomain.less_than_or_equal_to(10))
707
+ tmp = value_domain_greater_than_or_equal_to(-10)
708
+ tmp.intersection(value_domain_less_than_or_equal_to(10))
703
709
  end
704
710
 
705
711
  it "should intersect with (== 0)" do
706
- subject.intersect?(ValueDomain.equal_to(0)).should be_true
712
+ subject.intersect?(value_domain_equal_to(0)).should be_true
707
713
  end
708
714
 
709
715
  it "< (== 0) should be (== Unlimited)" do
710
- (subject < ValueDomain.equal_to(0)).to_s.should == "(== Unlimited)"
716
+ (subject < value_domain_equal_to(0)).to_s.should == "(== Unlimited)"
711
717
  end
712
718
 
713
719
  it "> (== 0) should be (== Unlimited)" do
714
- (subject > ValueDomain.equal_to(0)).to_s.should == "(== Unlimited)"
720
+ (subject > value_domain_equal_to(0)).to_s.should == "(== Unlimited)"
715
721
  end
716
722
 
717
723
  it "== (== 0) should be (== Unlimited)" do
718
- (subject == ValueDomain.equal_to(0)).to_s.should == "(== Unlimited)"
724
+ (subject == value_domain_equal_to(0)).to_s.should == "(== Unlimited)"
719
725
  end
720
726
 
721
727
  it "!= (== 0) should be (== Unlimited)" do
722
- (subject != ValueDomain.equal_to(0)).to_s.should == "(== Unlimited)"
728
+ (subject != value_domain_equal_to(0)).to_s.should == "(== Unlimited)"
723
729
  end
724
730
 
725
731
  it "< (== 20) should be ((< 0) || (> 0))" do
726
- (subject < ValueDomain.equal_to(20)).to_s.should ==
732
+ (subject < value_domain_equal_to(20)).to_s.should ==
727
733
  "((< 0) || (> 0))"
728
734
  end
729
735
 
730
736
  it "> (== 20) should be (== 0)" do
731
- (subject > ValueDomain.equal_to(20)).to_s.should == "(== 0)"
737
+ (subject > value_domain_equal_to(20)).to_s.should == "(== 0)"
732
738
  end
733
739
  end
734
740
 
735
741
  context "(((< 11) && (> 1)) || (== 11))" do
736
742
  subject do
737
- tmp = ValueDomain.greater_than(1)
738
- tmp = tmp.intersection(ValueDomain.less_than(11))
739
- tmp.union(ValueDomain.equal_to(11))
743
+ tmp = value_domain_greater_than(1)
744
+ tmp = tmp.intersection(value_domain_less_than(11))
745
+ tmp.union(value_domain_equal_to(11))
740
746
  end
741
747
 
742
748
  it "narrowed by == ((((< 10) && (> 0)) || (== 10)) || (== 0)) " +
743
749
  "should be (((< 10) && (> 1)) || (== 10))" do
744
- rhs = ValueDomain.greater_than(0)
745
- rhs = rhs.intersection(ValueDomain.less_than(10))
746
- rhs = rhs.union(ValueDomain.equal_to(0))
747
- rhs = rhs.union(ValueDomain.equal_to(10))
750
+ rhs = value_domain_greater_than(0)
751
+ rhs = rhs.intersection(value_domain_less_than(10))
752
+ rhs = rhs.union(value_domain_equal_to(0))
753
+ rhs = rhs.union(value_domain_equal_to(10))
748
754
  subject.narrow(Operator::EQ, rhs).to_s.should ==
749
755
  "(((< 10) && (> 1)) || (== 10))"
750
756
  end
@@ -752,30 +758,30 @@ module C
752
758
 
753
759
  context "((< 128) && (> -129))" do
754
760
  subject do
755
- tmp = ValueDomain.greater_than(-129)
756
- tmp.intersection(ValueDomain.less_than(128))
761
+ tmp = value_domain_greater_than(-129)
762
+ tmp.intersection(value_domain_less_than(128))
757
763
  end
758
764
 
759
765
  it "should intersect with (== -128)" do
760
- subject.intersect?(ValueDomain.equal_to(-128)).should be_true
766
+ subject.intersect?(value_domain_equal_to(-128)).should be_true
761
767
  end
762
768
 
763
769
  it "should intersect with (== 127)" do
764
- subject.intersect?(ValueDomain.equal_to(127)).should be_true
770
+ subject.intersect?(value_domain_equal_to(127)).should be_true
765
771
  end
766
772
  end
767
773
 
768
774
  context "((((< 2147483647) && (> -2147483648)) || " +
769
775
  "(== 2147483647)) || (== -2147483648))" do
770
776
  subject do
771
- tmp = ValueDomain.greater_than_or_equal_to(-2147483648)
772
- tmp.intersection(ValueDomain.less_than_or_equal_to(2147483647))
777
+ tmp = value_domain_greater_than_or_equal_to(-2147483648)
778
+ tmp.intersection(value_domain_less_than_or_equal_to(2147483647))
773
779
  end
774
780
 
775
781
  it "narrowed by != (== 1) should be " +
776
782
  "(((((< 1) && (> -2147483648)) || ((< 2147483647) && (> 1))) || " +
777
783
  "(== 2147483647)) || (== -2147483648))" do
778
- subject.narrow(Operator::NE, ValueDomain.equal_to(1)).to_s.should ==
784
+ subject.narrow(Operator::NE, value_domain_equal_to(1)).to_s.should ==
779
785
  "(((((< 1) && (> -2147483648)) || ((< 2147483647) && (> 1))) || " +
780
786
  "(== 2147483647)) || (== -2147483648))"
781
787
  end
@@ -783,8 +789,8 @@ module C
783
789
 
784
790
  context "(((< 10) && (> 0)) || (== 0))" do
785
791
  subject do
786
- tmp = ValueDomain.greater_than_or_equal_to(0)
787
- tmp.intersection(ValueDomain.less_than(10))
792
+ tmp = value_domain_greater_than_or_equal_to(0)
793
+ tmp.intersection(value_domain_less_than(10))
788
794
  end
789
795
 
790
796
  it "narrowed by != its cloned should be (== Nil)" do
@@ -794,41 +800,66 @@ module C
794
800
 
795
801
  context "((< 10) && (> 0))" do
796
802
  subject do
797
- tmp = ValueDomain.greater_than(0)
798
- tmp.intersection(ValueDomain.less_than(10))
803
+ tmp = value_domain_greater_than(0)
804
+ tmp.intersection(value_domain_less_than(10))
799
805
  end
800
806
 
801
807
  it "+ ((< 10) && (> 0)) should be ((< 10) && (> 0))" do
802
- rhs = ValueDomain.greater_than(0)
803
- rhs = rhs.intersection(ValueDomain.less_than(10))
808
+ rhs = value_domain_greater_than(0)
809
+ rhs = rhs.intersection(value_domain_less_than(10))
804
810
  (subject + rhs).to_s.should == "((< 20) && (> 0))"
805
811
  end
806
812
 
807
813
  it "* (== 2) should be ((< 20) && (> 0))" do
808
- rhs = ValueDomain.equal_to(2)
814
+ rhs = value_domain_equal_to(2)
809
815
  (subject * rhs).to_s.should == "((< 20) && (> 0))"
810
816
  end
811
817
 
812
818
  it "* ((< 10) && (> 0)) should be ((< 100) && (> 0))" do
813
- rhs = ValueDomain.greater_than(0)
814
- rhs = rhs.intersection(ValueDomain.less_than(10))
819
+ rhs = value_domain_greater_than(0)
820
+ rhs = rhs.intersection(value_domain_less_than(10))
815
821
  (subject * rhs).to_s.should == "((< 100) && (> 0))"
816
822
  end
817
823
 
818
824
  it "/ (== 2) should be ((< 5) && (> 0))" do
819
- rhs = ValueDomain.equal_to(2)
825
+ rhs = value_domain_equal_to(2)
820
826
  (subject / rhs).to_s.should == "((< 5) && (> 0))"
821
827
  end
822
828
 
823
829
  # TODO: Fix bad value-domain division before 1.14.0 GA release.
824
830
  #it "/ ((< 10) && (> 0)) should be ((< 10) && (> 0))" do
825
- # rhs = ValueDomain.greater_than(0)
826
- # rhs = rhs.intersection(ValueDomain.less_than(10))
831
+ # rhs = value_domain_greater_than(0)
832
+ # rhs = rhs.intersection(value_domain_less_than(10))
827
833
  # File.open("dump", "w") { |io| PP.pp(subject / rhs, io) }
828
834
  # (subject / rhs).to_s.should == "((< 10) && (> 0))"
829
835
  #end
830
836
  end
831
837
  end
838
+
839
+ private
840
+ def value_domain_equal_to(val)
841
+ ValueDomain.equal_to(val, logical_right_shift?)
842
+ end
843
+
844
+ def value_domain_less_than(val)
845
+ ValueDomain.less_than(val, logical_right_shift?)
846
+ end
847
+
848
+ def value_domain_greater_than(val)
849
+ ValueDomain.greater_than(val, logical_right_shift?)
850
+ end
851
+
852
+ def value_domain_less_than_or_equal_to(val)
853
+ ValueDomain.less_than_or_equal_to(val, logical_right_shift?)
854
+ end
855
+
856
+ def value_domain_greater_than_or_equal_to(val)
857
+ ValueDomain.greater_than_or_equal_to(val, logical_right_shift?)
858
+ end
859
+
860
+ def traits
861
+ @adlint.traits
862
+ end
832
863
  end
833
864
 
834
865
  end