facets 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (415) hide show
  1. data/CHANGELOG +4 -3
  2. data/ProjectInfo +5 -2
  3. data/conf/facets/noauto +11 -11
  4. data/lib/facet/aspects.rb +1 -0
  5. data/lib/facet/float/round_off.rb +1 -0
  6. data/lib/facet/kernel/instance.rb +1 -0
  7. data/lib/facet/kernel/pp_exception.rb +1 -0
  8. data/lib/facet/module/cattr.rb +1 -0
  9. data/lib/facet/module/on_included.rb +1 -0
  10. data/lib/facet/nilclass/blank.rb +1 -0
  11. data/lib/facet/numeric/approx.rb +1 -0
  12. data/lib/facet/ostruct/instance.rb +1 -0
  13. data/lib/facets.rb +0 -1
  14. data/lib/facets/core/enumerable/every.rb +1 -5
  15. data/lib/facets/core/float.rb +1 -0
  16. data/lib/facets/core/float/approx.rb +2 -42
  17. data/lib/facets/core/float/round_at.rb +2 -1
  18. data/lib/facets/core/float/round_off.rb +8 -0
  19. data/lib/facets/core/float/round_to.rb +2 -1
  20. data/lib/facets/core/gem.rb +0 -3
  21. data/lib/facets/core/hash/inverse.rb +3 -1
  22. data/lib/facets/core/inflect.rb +3 -0
  23. data/lib/facets/core/kernel.rb +2 -2
  24. data/lib/facets/core/kernel/{__meta__.rb → instance.rb} +10 -9
  25. data/lib/facets/core/kernel/pp_exception.rb +17 -0
  26. data/lib/facets/core/module.rb +2 -0
  27. data/lib/facets/core/module/attr.rb +4 -1
  28. data/lib/facets/core/module/basename.rb +12 -1
  29. data/lib/facets/core/module/cattr.rb +180 -0
  30. data/lib/facets/core/module/cattr_accessor.rb +2 -141
  31. data/lib/facets/core/module/cattr_reader.rb +1 -1
  32. data/lib/facets/core/module/cattr_writer.rb +1 -1
  33. data/lib/facets/core/module/on_included.rb +48 -0
  34. data/lib/facets/core/module/wrap_method.rb +7 -2
  35. data/lib/facets/core/nilclass.rb +1 -1
  36. data/lib/facets/core/nilclass/{to_f.rb → blank.rb} +6 -6
  37. data/lib/facets/core/nilclass/op_cmp.rb +11 -0
  38. data/lib/facets/core/nilclass/succ.rb +5 -0
  39. data/lib/facets/core/numeric.rb +1 -0
  40. data/lib/facets/core/numeric/approx.rb +34 -0
  41. data/lib/facets/core/ostruct/__update__.rb +2 -2
  42. data/lib/facets/core/ostruct/instance.rb +37 -0
  43. data/lib/facets/core/string/modulize.rb +1 -1
  44. data/lib/facets/more/consoleapp.rb +27 -16
  45. data/lib/facets/more/crypt.rb +8 -4
  46. data/lib/facets/more/elementor.rb +104 -0
  47. data/lib/facets/more/expirable.rb +5 -0
  48. data/lib/facets/more/nilcomparable.rb +88 -31
  49. data/lib/facets/more/overload.rb +1 -1
  50. data/lib/facets/more/typecast.rb +12 -3
  51. data/test/FIXTURE/filelist/testfile.txt +0 -0
  52. data/test/FIXTURE/filelist/testfile2.txt +0 -0
  53. data/test/lib/{facet → facets/core}/array/test_at_rand.rb +3 -3
  54. data/test/lib/{facet → facets/core}/array/test_delete_unless.rb +3 -3
  55. data/test/lib/{facet → facets/core}/array/test_delete_values.rb +3 -3
  56. data/test/lib/{facet → facets/core}/array/test_delete_values_at.rb +3 -3
  57. data/test/lib/{facet → facets/core}/array/test_first.rb +3 -3
  58. data/test/lib/{facet → facets/core}/array/test_head.rb +3 -3
  59. data/test/lib/{facet → facets/core}/array/test_last_index.rb +3 -3
  60. data/test/lib/{facet → facets/core}/array/test_merge.rb +3 -3
  61. data/test/lib/{facet → facets/core}/array/test_mid.rb +3 -3
  62. data/test/lib/{facet → facets/core}/array/test_middle.rb +3 -3
  63. data/test/lib/{facet → facets/core}/array/test_op_fetch.rb +3 -3
  64. data/test/lib/{facet → facets/core}/array/test_op_store.rb +3 -3
  65. data/test/lib/{facet → facets/core}/array/test_pick.rb +3 -3
  66. data/test/lib/{facet → facets/core}/array/test_pos.rb +3 -3
  67. data/test/lib/{facet → facets/core}/array/test_pull.rb +3 -3
  68. data/test/lib/{facet → facets/core}/array/test_rand_index.rb +3 -3
  69. data/test/lib/{facet → facets/core}/array/test_rand_subset.rb +3 -3
  70. data/test/lib/{facet → facets/core}/array/test_range.rb +3 -3
  71. data/test/lib/{facet → facets/core}/array/test_rotate.rb +3 -3
  72. data/test/lib/{facet → facets/core}/array/test_select.rb +3 -3
  73. data/test/lib/{facet → facets/core}/array/test_shuffle.rb +3 -3
  74. data/test/lib/{facet → facets/core}/array/test_slap.rb +3 -3
  75. data/test/lib/{facet → facets/core}/array/test_thru.rb +3 -3
  76. data/test/lib/{facet → facets/core}/array/test_to_b.rb +3 -3
  77. data/test/lib/{facet → facets/core}/array/test_to_h.rb +3 -3
  78. data/test/lib/{facet → facets/core}/array/test_to_hash.rb +3 -3
  79. data/test/lib/{facet → facets/core}/binding/self/test_of_caller.rb +3 -3
  80. data/test/lib/{facet → facets/core}/binding/test___LINE__.rb +3 -3
  81. data/test/lib/{facet → facets/core}/binding/test_call_stack.rb +3 -3
  82. data/test/lib/{facet → facets/core}/binding/test_called.rb +3 -3
  83. data/test/lib/{facet → facets/core}/binding/test_caller.rb +3 -3
  84. data/test/lib/{facet → facets/core}/binding/test_defined.rb +3 -3
  85. data/test/lib/{facet → facets/core}/binding/test_eval.rb +3 -3
  86. data/test/lib/{facet → facets/core}/binding/test_local_variables.rb +3 -3
  87. data/test/lib/{facet → facets/core}/binding/test_method_name.rb +3 -3
  88. data/test/lib/{facet → facets/core}/binding/test_op_fetch.rb +3 -3
  89. data/test/lib/{facet → facets/core}/binding/test_op_store.rb +3 -3
  90. data/test/lib/{facet → facets/core}/binding/test_self.rb +3 -3
  91. data/test/lib/{facet → facets/core}/class/test_descendents.rb +3 -3
  92. data/test/lib/{facet → facets/core}/class/test_method_name.rb +3 -3
  93. data/test/lib/{facet → facets/core}/class/test_remove_descendents.rb +3 -3
  94. data/test/lib/{facet → facets/core}/class/test_unix_path.rb +3 -3
  95. data/test/lib/{facet → facets/core}/comparable/test_at_least.rb +3 -3
  96. data/test/lib/{facet → facets/core}/comparable/test_clip.rb +3 -3
  97. data/test/lib/{facet → facets/core}/comparable/test_cmp.rb +3 -3
  98. data/test/lib/{facet → facets/core}/continuation/self/test_create.rb +3 -3
  99. data/test/lib/{facet → facets/core}/date/test_days_in_month.rb +3 -3
  100. data/test/lib/{facet → facets/core}/date/test_days_of_month.rb +3 -3
  101. data/test/lib/{facet → facets/core}/date/test_stamp.rb +3 -3
  102. data/test/lib/{facet → facets/core}/date/test_to_date.rb +3 -3
  103. data/test/lib/{facet → facets/core}/date/test_to_s.rb +3 -3
  104. data/test/lib/{facet → facets/core}/date/test_to_time.rb +3 -3
  105. data/test/lib/{facet → facets/core}/dir/self/test_ancestor.rb +3 -3
  106. data/test/lib/{facet → facets/core}/dir/self/test_ascend.rb +3 -3
  107. data/test/lib/{facet → facets/core}/dir/self/test_ls_r.rb +3 -3
  108. data/test/lib/{facet → facets/core}/enumerable/self/test_combinations.rb +3 -3
  109. data/test/lib/{facet → facets/core}/enumerable/self/test_cross.rb +3 -3
  110. data/test/lib/{facet → facets/core}/enumerable/test_collect_with_index.rb +3 -3
  111. data/test/lib/{facet → facets/core}/enumerable/test_commonality.rb +3 -3
  112. data/test/lib/{facet → facets/core}/enumerable/test_compact_collect.rb +3 -3
  113. data/test/lib/{facet → facets/core}/enumerable/test_cross.rb +3 -3
  114. data/test/lib/{facet → facets/core}/enumerable/test_each_combination.rb +3 -3
  115. data/test/lib/{facet → facets/core}/enumerable/test_each_pair.rb +3 -3
  116. data/test/lib/{facet → facets/core}/enumerable/test_each_slice.rb +3 -3
  117. data/test/lib/{facet → facets/core}/enumerable/test_each_unique_pair.rb +3 -3
  118. data/test/lib/{facet → facets/core}/enumerable/test_entropy.rb +3 -3
  119. data/test/lib/{facet → facets/core}/enumerable/test_every.rb +3 -3
  120. data/test/lib/{facet → facets/core}/enumerable/test_ew.rb +3 -3
  121. data/test/lib/{facet → facets/core}/enumerable/test_filter_collect.rb +3 -3
  122. data/test/lib/{facet → facets/core}/enumerable/test_find_collisions.rb +3 -3
  123. data/test/lib/{facet → facets/core}/enumerable/test_frequency.rb +3 -3
  124. data/test/lib/{facet → facets/core}/enumerable/test_graph.rb +3 -3
  125. data/test/lib/{facet → facets/core}/enumerable/test_ideal_entropy.rb +3 -3
  126. data/test/lib/{facet → facets/core}/enumerable/test_none.rb +3 -3
  127. data/test/lib/{facet → facets/core}/enumerable/test_occur.rb +3 -3
  128. data/test/lib/{facet → facets/core}/enumerable/test_one.rb +3 -3
  129. data/test/lib/{facet → facets/core}/enumerable/test_op_pow.rb +3 -3
  130. data/test/lib/{facet → facets/core}/enumerable/test_partition_by.rb +3 -3
  131. data/test/lib/{facet → facets/core}/enumerable/test_permute.rb +3 -3
  132. data/test/lib/{facet → facets/core}/enumerable/test_probability.rb +3 -3
  133. data/test/lib/{facet → facets/core}/enumerable/test_to_h.rb +3 -3
  134. data/test/lib/{facet → facets/core}/enumerable/test_uniq_by.rb +3 -3
  135. data/test/lib/{facet → facets/core}/file/self/test_create.rb +3 -3
  136. data/test/lib/{facet → facets/core}/file/self/test_open_as_string.rb +3 -3
  137. data/test/lib/{facet → facets/core}/file/self/test_read_list.rb +3 -3
  138. data/test/lib/{facet → facets/core}/file/self/test_sanitize.rb +3 -3
  139. data/test/lib/{facet → facets/core}/file/self/test_split_all.rb +3 -3
  140. data/test/lib/{facet → facets/core}/fileutils/test_wc.rb +3 -3
  141. data/test/lib/{facet → facets/core}/fileutils/test_which.rb +3 -3
  142. data/test/lib/{facet → facets/core}/float/test_approx.rb +3 -3
  143. data/test/lib/{facet → facets/core}/float/test_round_at.rb +3 -3
  144. data/test/lib/{facet → facets/core}/float/test_round_to.rb +3 -3
  145. data/test/lib/{facet → facets/core}/hash/self/test_zipnew.rb +3 -3
  146. data/test/lib/{facet → facets/core}/hash/test_alias.rb +3 -3
  147. data/test/lib/{facet → facets/core}/hash/test_assert_has_keys.rb +3 -3
  148. data/test/lib/{facet → facets/core}/hash/test_assert_has_only_keys.rb +3 -3
  149. data/test/lib/{facet → facets/core}/hash/test_at.rb +3 -3
  150. data/test/lib/{facet → facets/core}/hash/test_collate.rb +3 -3
  151. data/test/lib/{facet → facets/core}/hash/test_each.rb +3 -3
  152. data/test/lib/{facet → facets/core}/hash/test_each_with_index.rb +3 -3
  153. data/test/lib/{facet → facets/core}/hash/test_each_with_key.rb +3 -3
  154. data/test/lib/{facet → facets/core}/hash/test_graph.rb +3 -3
  155. data/test/lib/{facet → facets/core}/hash/test_has_keys.rb +3 -3
  156. data/test/lib/{facet → facets/core}/hash/test_has_only_keys.rb +3 -3
  157. data/test/lib/{facet → facets/core}/hash/test_inverse.rb +6 -4
  158. data/test/lib/{facet → facets/core}/hash/test_keys_to_s.rb +3 -3
  159. data/test/lib/{facet → facets/core}/hash/test_keys_to_sym.rb +3 -3
  160. data/test/lib/{facet → facets/core}/hash/test_op_fetch.rb +3 -3
  161. data/test/lib/{facet → facets/core}/hash/test_op_lshift.rb +3 -3
  162. data/test/lib/{facet → facets/core}/hash/test_rand_key.rb +3 -3
  163. data/test/lib/{facet → facets/core}/hash/test_rand_pair.rb +3 -3
  164. data/test/lib/{facet → facets/core}/hash/test_rand_value.rb +3 -3
  165. data/test/lib/{facet → facets/core}/hash/test_replace_each.rb +3 -3
  166. data/test/lib/{facet → facets/core}/hash/test_shuffle.rb +3 -3
  167. data/test/lib/{facet → facets/core}/hash/test_slice.rb +3 -3
  168. data/test/lib/{facet → facets/core}/hash/test_swap.rb +3 -3
  169. data/test/lib/{facet → facets/core}/hash/test_swapkey.rb +3 -3
  170. data/test/lib/{facet → facets/core}/hash/test_to_h.rb +3 -3
  171. data/test/lib/{facet → facets/core}/hash/test_to_ostruct.rb +3 -3
  172. data/test/lib/{facet → facets/core}/hash/test_to_ostruct_recurse.rb +3 -3
  173. data/test/lib/{facet → facets/core}/hash/test_traverse.rb +3 -3
  174. data/test/lib/{facet → facets/core}/hash/test_update_each.rb +3 -3
  175. data/test/lib/{facet → facets/core}/hash/test_update_keys.rb +3 -3
  176. data/test/lib/{facet → facets/core}/hash/test_update_values.rb +3 -3
  177. data/test/lib/{facet → facets/core}/hash/test_weave.rb +3 -3
  178. data/test/lib/{facet → facets/core}/integer/test_factorial.rb +3 -3
  179. data/test/lib/{facet → facets/core}/integer/test_multiple.rb +3 -3
  180. data/test/lib/{facet → facets/core}/integer/test_ordinal.rb +3 -3
  181. data/test/lib/{facet → facets/core}/integer/test_times_collect.rb +3 -3
  182. data/test/lib/{facet → facets/core}/kernel/test___class__.rb +3 -3
  183. data/test/lib/{facet → facets/core}/kernel/test_as.rb +3 -3
  184. data/test/lib/{facet → facets/core}/kernel/test_assign_from.rb +3 -3
  185. data/test/lib/{facet → facets/core}/kernel/test_assign_with.rb +3 -3
  186. data/test/lib/{facet → facets/core}/kernel/test_bool.rb +3 -3
  187. data/test/lib/{facet → facets/core}/kernel/test_bug.rb +3 -3
  188. data/test/lib/{facet → facets/core}/kernel/test_call_stack.rb +3 -3
  189. data/test/lib/{facet → facets/core}/kernel/test_called.rb +3 -3
  190. data/test/lib/{facet → facets/core}/kernel/test_constant.rb +3 -3
  191. data/test/lib/{facet → facets/core}/kernel/test_copy.rb +3 -3
  192. data/test/lib/{facet → facets/core}/kernel/test_deep_copy.rb +3 -3
  193. data/test/lib/{facet → facets/core}/kernel/test_demo.rb +3 -3
  194. data/test/lib/{facet → facets/core}/kernel/test_fn.rb +3 -3
  195. data/test/lib/{facet → facets/core}/kernel/test_generate_method_name.rb +3 -3
  196. data/test/lib/{facet → facets/core}/kernel/test_get_by_id.rb +3 -3
  197. data/test/lib/{facet → facets/core}/kernel/test_here.rb +3 -3
  198. data/test/lib/{facet → facets/core}/kernel/test_in.rb +3 -3
  199. data/test/lib/{facet → facets/core}/kernel/test_maybe.rb +3 -3
  200. data/test/lib/{facet → facets/core}/kernel/test_metaclass.rb +3 -3
  201. data/test/lib/{facet → facets/core}/kernel/test_method.rb +3 -3
  202. data/test/lib/{facet → facets/core}/kernel/test_method_name.rb +3 -3
  203. data/test/lib/{facet → facets/core}/kernel/test_methods.rb +3 -3
  204. data/test/lib/{facet → facets/core}/kernel/test_new.rb +3 -3
  205. data/test/lib/{facet → facets/core}/kernel/test_object_class.rb +3 -3
  206. data/test/lib/{facet → facets/core}/kernel/test_object_hexid.rb +3 -3
  207. data/test/lib/{facet → facets/core}/kernel/test_require_all.rb +3 -3
  208. data/test/lib/{facet → facets/core}/kernel/test_require_esc.rb +3 -3
  209. data/test/lib/{facet → facets/core}/kernel/test_require_facet.rb +3 -3
  210. data/test/lib/{facet → facets/core}/kernel/test_resc.rb +3 -3
  211. data/test/lib/{facet → facets/core}/kernel/test_returning.rb +3 -3
  212. data/test/lib/{facet → facets/core}/kernel/test_send_as.rb +3 -3
  213. data/test/lib/{facet → facets/core}/kernel/test_set_from.rb +3 -3
  214. data/test/lib/{facet → facets/core}/kernel/test_set_with.rb +3 -3
  215. data/test/lib/{facet → facets/core}/kernel/test_silently.rb +3 -3
  216. data/test/lib/{facet → facets/core}/kernel/test_singleton.rb +3 -3
  217. data/test/lib/{facet → facets/core}/kernel/test_superior.rb +3 -3
  218. data/test/lib/{facet → facets/core}/kernel/test_supermethod.rb +3 -3
  219. data/test/lib/{facet → facets/core}/kernel/test_this.rb +3 -3
  220. data/test/lib/{facet → facets/core}/kernel/test_to_b.rb +3 -3
  221. data/test/lib/{facet → facets/core}/kernel/test_to_bool.rb +3 -3
  222. data/test/lib/{facet → facets/core}/kernel/test_uri.rb +3 -3
  223. data/test/lib/{facet → facets/core}/kernel/test_val.rb +3 -3
  224. data/test/lib/{facet → facets/core}/kernel/test_with_accessor.rb +3 -3
  225. data/test/lib/{facet → facets/core}/matchdata/test_match.rb +3 -3
  226. data/test/lib/{facet → facets/core}/matchdata/test_matchtree.rb +3 -3
  227. data/test/lib/{facet → facets/core}/module/test_abstract.rb +3 -3
  228. data/test/lib/{facet → facets/core}/module/test_alias_module_function.rb +3 -3
  229. data/test/lib/{facet → facets/core}/module/test_ancestor.rb +3 -3
  230. data/test/lib/{facet → facets/core}/module/test_basename.rb +3 -3
  231. data/test/lib/{facet → facets/core}/module/test_by_name.rb +3 -3
  232. data/test/lib/{facet → facets/core}/module/test_cattr_accessor.rb +3 -3
  233. data/test/lib/{facet → facets/core}/module/test_clone_using.rb +3 -3
  234. data/test/lib/{facet → facets/core}/module/test_dirname.rb +3 -3
  235. data/test/lib/{facet → facets/core}/module/test_equate_on.rb +3 -3
  236. data/test/lib/{facet → facets/core}/module/test_generate_instance_method_name.rb +3 -3
  237. data/test/lib/{facet → facets/core}/module/test_include_as.rb +3 -3
  238. data/test/lib/{facet → facets/core}/module/test_initializer.rb +3 -3
  239. data/test/lib/{facet → facets/core}/module/test_instance_methods.rb +3 -3
  240. data/test/lib/{facet → facets/core}/module/test_integrate.rb +3 -3
  241. data/test/lib/{facet → facets/core}/module/test_memoize.rb +3 -3
  242. data/test/lib/{facet → facets/core}/module/test_modspace.rb +3 -3
  243. data/test/lib/{facet → facets/core}/module/test_namespace.rb +3 -3
  244. data/test/lib/{facet → facets/core}/module/test_nesting.rb +3 -3
  245. data/test/lib/{facet → facets/core}/module/test_redef.rb +3 -3
  246. data/test/lib/{facet → facets/core}/module/test_redefine_method.rb +3 -3
  247. data/test/lib/{facet → facets/core}/module/test_redirect.rb +3 -3
  248. data/test/lib/{facet → facets/core}/module/test_redirect_method.rb +3 -3
  249. data/test/lib/{facet → facets/core}/module/test_remove.rb +3 -3
  250. data/test/lib/{facet → facets/core}/module/test_rename.rb +3 -3
  251. data/test/lib/{facet → facets/core}/module/test_rename_method.rb +3 -3
  252. data/test/lib/{facet → facets/core}/module/test_revisal.rb +3 -3
  253. data/test/lib/{facet → facets/core}/module/test_shadow_method.rb +3 -3
  254. data/test/lib/{facet → facets/core}/module/test_sort_on.rb +3 -3
  255. data/test/lib/{facet → facets/core}/module/test_undef.rb +3 -3
  256. data/test/lib/{facet → facets/core}/module/test_wrap.rb +3 -3
  257. data/test/lib/{facet → facets/core}/module/test_wrap_method.rb +3 -3
  258. data/test/lib/{facet → facets/core}/nilclass/test_empty.rb +3 -3
  259. data/test/lib/{facet → facets/core}/nilclass/test_include.rb +3 -3
  260. data/test/lib/{facet → facets/core}/nilclass/test_op_fetch.rb +3 -3
  261. data/test/lib/{facet → facets/core}/nilclass/test_size.rb +3 -3
  262. data/test/lib/{facet → facets/core}/nilclass/test_to_f.rb +3 -3
  263. data/test/lib/{facet → facets/core}/nilclass/test_to_h.rb +3 -3
  264. data/test/lib/{facet → facets/core}/numeric/test_ceil_multiple.rb +3 -3
  265. data/test/lib/{facet → facets/core}/numeric/test_succ.rb +3 -3
  266. data/test/lib/{facet → facets/core}/numeric/test_to_b.rb +3 -3
  267. data/test/lib/{facet → facets/core}/ostruct/test___merge__.rb +3 -3
  268. data/test/lib/{facet → facets/core}/ostruct/test___update__.rb +3 -3
  269. data/test/lib/{facet → facets/core}/ostruct/test_op_fetch.rb +3 -3
  270. data/test/lib/{facet → facets/core}/ostruct/test_op_store.rb +3 -3
  271. data/test/lib/{facet → facets/core}/proc/test_compose.rb +3 -3
  272. data/test/lib/{facet → facets/core}/proc/test_to_method.rb +3 -3
  273. data/test/lib/{facet → facets/core}/range/test_to_r.rb +3 -3
  274. data/test/lib/{facet → facets/core}/range/test_to_range.rb +3 -3
  275. data/test/lib/{facet → facets/core}/range/test_umbrella.rb +3 -3
  276. data/test/lib/{facet → facets/core}/range/test_within.rb +3 -3
  277. data/test/lib/{facet → facets/core}/regexp/test_arity.rb +3 -3
  278. data/test/lib/{facet → facets/core}/regexp/test_to_re.rb +3 -3
  279. data/test/lib/{facet → facets/core}/regexp/test_to_regexp.rb +3 -3
  280. data/test/lib/{facet → facets/core}/string/self/test_interpolate.rb +3 -3
  281. data/test/lib/{facet → facets/core}/string/self/test_patterns.rb +3 -3
  282. data/test/lib/{facet → facets/core}/string/self/test_rand_letter.rb +3 -3
  283. data/test/lib/{facet → facets/core}/string/test_align_center.rb +3 -3
  284. data/test/lib/{facet → facets/core}/string/test_at_rand.rb +3 -3
  285. data/test/lib/{facet → facets/core}/string/test_basename.rb +3 -3
  286. data/test/lib/{facet → facets/core}/string/test_blank.rb +3 -3
  287. data/test/lib/{facet → facets/core}/string/test_bracket.rb +3 -3
  288. data/test/lib/{facet → facets/core}/string/test_camelcase.rb +3 -3
  289. data/test/lib/{facet → facets/core}/string/test_camelize.rb +3 -3
  290. data/test/lib/{facet → facets/core}/string/test_capitalized.rb +3 -3
  291. data/test/lib/{facet → facets/core}/string/test_chars.rb +3 -3
  292. data/test/lib/{facet → facets/core}/string/test_cmp.rb +3 -3
  293. data/test/lib/{facet → facets/core}/string/test_demodulize.rb +3 -3
  294. data/test/lib/{facet → facets/core}/string/test_downcase.rb +3 -3
  295. data/test/lib/{facet → facets/core}/string/test_dresner.rb +3 -3
  296. data/test/lib/{facet → facets/core}/string/test_each_char.rb +3 -3
  297. data/test/lib/{facet → facets/core}/string/test_each_word.rb +3 -3
  298. data/test/lib/{facet → facets/core}/string/test_first.rb +3 -3
  299. data/test/lib/{facet → facets/core}/string/test_fold.rb +3 -3
  300. data/test/lib/{facet → facets/core}/string/test_frequency.rb +3 -3
  301. data/test/lib/{facet → facets/core}/string/test_humanize.rb +3 -3
  302. data/test/lib/{facet → facets/core}/string/test_indent.rb +3 -3
  303. data/test/lib/{facet → facets/core}/string/test_index_all.rb +3 -3
  304. data/test/lib/{facet → facets/core}/string/test_last.rb +3 -3
  305. data/test/lib/{facet → facets/core}/string/test_line_wrap.rb +3 -3
  306. data/test/lib/{facet → facets/core}/string/test_lines.rb +3 -3
  307. data/test/lib/{facet → facets/core}/string/test_lowercase.rb +3 -3
  308. data/test/lib/{facet → facets/core}/string/test_margin.rb +3 -3
  309. data/test/lib/{facet → facets/core}/string/test_methodize.rb +3 -3
  310. data/test/lib/{facet → facets/core}/string/test_modulize.rb +3 -3
  311. data/test/lib/{facet → facets/core}/string/test_mscan.rb +3 -3
  312. data/test/lib/{facet → facets/core}/string/test_natcmp.rb +3 -3
  313. data/test/lib/{facet → facets/core}/string/test_nchar.rb +3 -3
  314. data/test/lib/{facet → facets/core}/string/test_pathize.rb +3 -3
  315. data/test/lib/{facet → facets/core}/string/test_pop.rb +3 -3
  316. data/test/lib/{facet → facets/core}/string/test_probability.rb +3 -3
  317. data/test/lib/{facet → facets/core}/string/test_push.rb +3 -3
  318. data/test/lib/{facet → facets/core}/string/test_quote.rb +3 -3
  319. data/test/lib/{facet → facets/core}/string/test_rand_byte.rb +3 -3
  320. data/test/lib/{facet → facets/core}/string/test_rand_index.rb +3 -3
  321. data/test/lib/{facet → facets/core}/string/test_range.rb +3 -3
  322. data/test/lib/{facet → facets/core}/string/test_range_all.rb +3 -3
  323. data/test/lib/{facet → facets/core}/string/test_range_of_line.rb +3 -3
  324. data/test/lib/{facet → facets/core}/string/test_regesc.rb +3 -3
  325. data/test/lib/{facet → facets/core}/string/test_shatter.rb +3 -3
  326. data/test/lib/{facet → facets/core}/string/test_shift.rb +3 -3
  327. data/test/lib/{facet → facets/core}/string/test_shuffle.rb +3 -3
  328. data/test/lib/{facet → facets/core}/string/test_similarity.rb +3 -3
  329. data/test/lib/{facet → facets/core}/string/test_singular.rb +3 -3
  330. data/test/lib/{facet → facets/core}/string/test_slap.rb +3 -3
  331. data/test/lib/{facet → facets/core}/string/test_soundex.rb +3 -3
  332. data/test/lib/{facet → facets/core}/string/test_succ.rb +3 -3
  333. data/test/lib/{facet → facets/core}/string/test_to_a.rb +3 -3
  334. data/test/lib/{facet → facets/core}/string/test_to_arr.rb +3 -3
  335. data/test/lib/{facet → facets/core}/string/test_to_b.rb +3 -3
  336. data/test/lib/{facet → facets/core}/string/test_to_const.rb +3 -3
  337. data/test/lib/{facet → facets/core}/string/test_to_date.rb +3 -3
  338. data/test/lib/{facet → facets/core}/string/test_to_proc.rb +3 -3
  339. data/test/lib/{facet → facets/core}/string/test_to_re.rb +3 -3
  340. data/test/lib/{facet → facets/core}/string/test_to_time.rb +3 -3
  341. data/test/lib/{facet → facets/core}/string/test_unix_crypt.rb +3 -3
  342. data/test/lib/{facet → facets/core}/string/test_unpack.rb +3 -3
  343. data/test/lib/{facet → facets/core}/string/test_unshift.rb +3 -3
  344. data/test/lib/{facet → facets/core}/string/test_upcase.rb +3 -3
  345. data/test/lib/{facet → facets/core}/string/test_whitespace.rb +3 -3
  346. data/test/lib/{facet → facets/core}/string/test_word_filter.rb +3 -3
  347. data/test/lib/{facet → facets/core}/string/test_word_wrap.rb +3 -3
  348. data/test/lib/{facet → facets/core}/string/test_words.rb +3 -3
  349. data/test/lib/{facet → facets/core}/symbol/test_camelcase.rb +3 -3
  350. data/test/lib/{facet → facets/core}/symbol/test_camelize.rb +3 -3
  351. data/test/lib/{facet → facets/core}/symbol/test_capitalize.rb +3 -3
  352. data/test/lib/{facet → facets/core}/symbol/test_capitalized.rb +3 -3
  353. data/test/lib/{facet → facets/core}/symbol/test_downcase.rb +3 -3
  354. data/test/lib/{facet → facets/core}/symbol/test_not.rb +3 -3
  355. data/test/lib/{facet → facets/core}/symbol/test_pad.rb +3 -3
  356. data/test/lib/{facet → facets/core}/symbol/test_succ.rb +3 -3
  357. data/test/lib/{facet → facets/core}/symbol/test_to_const.rb +3 -3
  358. data/test/lib/{facet → facets/core}/symbol/test_to_proc.rb +3 -3
  359. data/test/lib/{facet → facets/core}/symbol/test_to_str.rb +3 -3
  360. data/test/lib/{facet → facets/core}/symbol/test_underscore.rb +3 -3
  361. data/test/lib/{facet → facets/core}/symbol/test_upcase.rb +3 -3
  362. data/test/lib/{facet → facets/core}/time/test_change.rb +3 -3
  363. data/test/lib/{facet → facets/core}/time/test_elapse.rb +3 -3
  364. data/test/lib/{facet → facets/core}/time/test_stamp.rb +3 -3
  365. data/test/lib/{facet → facets/core}/time/test_to_date.rb +3 -3
  366. data/test/lib/{facet → facets/core}/time/test_to_s.rb +3 -3
  367. data/test/lib/{facet → facets/core}/time/test_to_time.rb +3 -3
  368. data/test/lib/facets/more/test_annotation.rb +217 -0
  369. data/test/lib/facets/more/test_ansicode.rb +36 -0
  370. data/test/lib/facets/more/test_association.rb +46 -0
  371. data/test/lib/facets/more/test_bbcode.rb +34 -0
  372. data/test/lib/facets/more/test_bitmask.rb +47 -0
  373. data/test/lib/facets/more/test_bytes.rb +84 -0
  374. data/test/lib/facets/more/test_classinherit.rb +65 -0
  375. data/test/lib/facets/more/test_classmethods.rb +65 -0
  376. data/test/lib/facets/more/test_coroutine.rb +60 -0
  377. data/test/lib/facets/more/test_crypt.rb +46 -0
  378. data/test/lib/facets/more/test_dictionary.rb +97 -0
  379. data/test/lib/facets/more/test_enumerablepass.rb +86 -0
  380. data/test/lib/facets/more/test_floatstring.rb +36 -0
  381. data/test/lib/facets/more/test_functor.rb +39 -0
  382. data/test/lib/facets/more/test_inheritor.rb +155 -0
  383. data/test/lib/facets/more/test_interval.rb +119 -0
  384. data/test/lib/facets/more/test_lisp.rb +47 -0
  385. data/test/lib/facets/more/test_lisp_format.rb +37 -0
  386. data/test/lib/facets/more/test_lrucache.rb +25 -0
  387. data/test/lib/facets/more/test_mathconstants.rb +18 -0
  388. data/test/lib/facets/more/test_methodprobe.rb +53 -0
  389. data/test/lib/facets/more/test_multipliers.rb +114 -0
  390. data/test/lib/facets/more/test_multiton.rb +200 -0
  391. data/test/lib/facets/more/test_nackclass.rb +45 -0
  392. data/test/lib/facets/more/test_nilcomparable.rb +43 -0
  393. data/test/lib/facets/more/test_openobject.rb +66 -0
  394. data/test/lib/facets/more/test_overload.rb +54 -0
  395. data/test/lib/facets/more/test_paramix.rb +100 -0
  396. data/test/lib/facets/more/test_preinitialize.rb +49 -0
  397. data/test/lib/facets/more/test_promoteself.rb +45 -0
  398. data/test/lib/facets/more/test_snapshot.rb +34 -0
  399. data/test/lib/facets/more/test_statichash.rb +31 -0
  400. data/test/lib/facets/more/test_syncarray.rb +28 -0
  401. data/test/lib/facets/more/test_synchash.rb +28 -0
  402. data/test/lib/facets/more/test_tagiterator.rb +93 -0
  403. data/test/lib/facets/more/test_timer.rb +66 -0
  404. data/test/lib/facets/more/test_times.rb +73 -0
  405. data/test/lib/facets/more/test_tuple.rb +32 -0
  406. data/test/lib/facets/more/test_typecast.rb +65 -0
  407. data/test/lib/facets/more/test_uninheritable.rb +42 -0
  408. data/test/lib/facets/more/test_units.rb +104 -0
  409. data/test/lib/facets/more/test_yamlstruct.rb +37 -0
  410. metadata +416 -357
  411. data/lib/facet/kernel/__meta__.rb +0 -1
  412. data/lib/facet/kernel/meta.rb +0 -1
  413. data/lib/facet/nilclass/to_f.rb +0 -1
  414. data/lib/facets/core/kernel/meta.rb +0 -2
  415. data/test/lib/facet/fileutils/test_slice.rb +0 -96
@@ -0,0 +1,97 @@
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |_
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for lib/facets/more/dictionary.rb
8
+ #
9
+ # Extracted Fri Mar 24 23:42:50 UTC 2006
10
+ # Unit Tools Reap Test Extractor
11
+ #
12
+
13
+ require 'facets/more/dictionary.rb'
14
+
15
+
16
+ require 'test/unit'
17
+
18
+ class TC_Dictionary < Test::Unit::TestCase
19
+
20
+ def test_create
21
+ hsh = Dictionary['z', 1, 'a', 2, 'c', 3]
22
+ assert_equal( ['z','a','c'], hsh.keys )
23
+ end
24
+
25
+ def test_op_store
26
+ hsh = Dictionary.new
27
+ hsh['z'] = 1
28
+ hsh['a'] = 2
29
+ hsh['c'] = 3
30
+ assert_equal( ['z','a','c'], hsh.keys )
31
+ end
32
+
33
+ def test_push
34
+ hsh = Dictionary['a', 1, 'c', 2, 'z', 3]
35
+ assert( hsh.push('end', 15) )
36
+ assert_equal( 15, hsh['end'] )
37
+ assert( ! hsh.push('end', 30) )
38
+ assert( hsh.unshift('begin', 50) )
39
+ assert_equal( 50, hsh['begin'] )
40
+ assert( ! hsh.unshift('begin', 60) )
41
+ assert_equal( ["begin", "a", "c", "z", "end"], hsh.keys )
42
+ assert_equal( ["end", 15], hsh.pop )
43
+ assert_equal( ["begin", "a", "c", "z"], hsh.keys )
44
+ assert_equal( ["begin", 50], hsh.shift )
45
+ end
46
+
47
+ def test_insert
48
+ # front
49
+ h = Dictionary['a', 1, 'b', 2, 'c', 3]
50
+ r = Dictionary['d', 4, 'a', 1, 'b', 2, 'c', 3]
51
+ assert_equal( 4, h.insert(0,'d',4) )
52
+ assert_equal( r, h )
53
+ # back
54
+ h = Dictionary['a', 1, 'b', 2, 'c', 3]
55
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
56
+ assert_equal( 4, h.insert(-1,'d',4) )
57
+ assert_equal( r, h )
58
+ end
59
+
60
+ def test_update
61
+ # with other orderred hash
62
+ h1 = Dictionary['a', 1, 'b', 2, 'c', 3]
63
+ h2 = Dictionary['d', 4]
64
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
65
+ assert_equal( r, h1.update(h2) )
66
+ assert_equal( r, h1 )
67
+ # with other hash
68
+ h1 = Dictionary['a', 1, 'b', 2, 'c', 3]
69
+ h2 = { 'd' => 4 }
70
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
71
+ assert_equal( r, h1.update(h2) )
72
+ assert_equal( r, h1 )
73
+ end
74
+
75
+ def test_merge
76
+ # with other orderred hash
77
+ h1 = Dictionary['a', 1, 'b', 2, 'c', 3]
78
+ h2 = Dictionary['d', 4]
79
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
80
+ assert_equal( r, h1.merge(h2) )
81
+ # with other hash
82
+ h1 = Dictionary['a', 1, 'b', 2, 'c', 3]
83
+ h2 = { 'd' => 4 }
84
+ r = Dictionary['a', 1, 'b', 2, 'c', 3, 'd', 4]
85
+ assert_equal( r, h1.merge(h2) )
86
+ end
87
+
88
+ def test_order_by
89
+ h1 = Dictionary['a', 3, 'b', 2, 'c', 1]
90
+ h1.order_by{ |k,v| v }
91
+ assert_equal( [1,2,3], h1.values )
92
+ assert_equal( ['c','b','a'], h1.keys )
93
+ end
94
+
95
+ end
96
+
97
+
@@ -0,0 +1,86 @@
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |_
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for lib/facets/more/enumerablepass.rb
8
+ #
9
+ # Extracted Fri Mar 24 23:42:50 UTC 2006
10
+ # Unit Tools Reap Test Extractor
11
+ #
12
+
13
+ require 'facets/more/enumerablepass.rb'
14
+
15
+
16
+ require 'test/unit'
17
+
18
+ # fixture
19
+
20
+ class PlusArray
21
+ include EnumerablePass
22
+ def initialize(arr)
23
+ @arr = arr
24
+ end
25
+ def each(n=0)
26
+ @arr.each{ |e| yield(e+n) }
27
+ end
28
+ end
29
+
30
+ class TC_Enumerable < Test::Unit::TestCase
31
+
32
+ def test_collect
33
+ t = PlusArray.new([1,2,3])
34
+ assert_equal( [5,6,7], t.collect(4){ |e| e } )
35
+ end
36
+
37
+ #def test_each_slice
38
+ # t = PlusArray.new([1,2,3,4])
39
+ # a = []
40
+ # t.each_slice(2,4){ |e,f| a << [e,f] }
41
+ # assert_equal( [[5,6],[7,8]], a )
42
+ #end
43
+
44
+ #def test_find
45
+ # t = PlusArray.new([1,2,3,4])
46
+ # f = t.find(2, :ifnone=>lambda{:NOPE}) { |a| a == 10 }
47
+ # assert_equal(:NOPE, f)
48
+ #end
49
+
50
+ def test_grep
51
+ # TODO
52
+ end
53
+
54
+ def test_to_a
55
+ t = PlusArray.new([1,2,3])
56
+ assert_equal( [5,6,7], t.to_a(4) )
57
+ end
58
+
59
+ def test_min
60
+ t = PlusArray.new([1,2,3])
61
+ assert_equal( 5, t.min(4) )
62
+ end
63
+
64
+ def test_max
65
+ t = PlusArray.new([1,2,3])
66
+ assert_equal( 7, t.max(4) )
67
+ end
68
+
69
+ def test_include?
70
+ t = PlusArray.new([1,2,3])
71
+ assert( t.include?(7,4) )
72
+ end
73
+
74
+ def test_select
75
+ t = PlusArray.new([1,2,3])
76
+ assert_equal( [6], t.select(4){ |x| x == 6 } )
77
+ end
78
+
79
+ def test_reject
80
+ t = PlusArray.new([1,2,3])
81
+ assert_equal( [5,7], t.reject(4){ |x| x == 6 } )
82
+ end
83
+
84
+ end
85
+
86
+
@@ -0,0 +1,36 @@
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |_
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for lib/facets/more/floatstring.rb
8
+ #
9
+ # Extracted Fri Mar 24 23:42:50 UTC 2006
10
+ # Unit Tools Reap Test Extractor
11
+ #
12
+
13
+ require 'facets/more/floatstring.rb'
14
+
15
+
16
+ require 'test/unit'
17
+
18
+ class TC_FloatString < Test::Unit::TestCase
19
+
20
+ def test_inner_inset
21
+ fs = FloatString.new( "Hello World!" )
22
+ fs.inner_insert("XXX", 4)
23
+ assert_equal("HellXXXo World!", fs.to_s)
24
+ fs.inner_insert("YYY", 4)
25
+ assert_equal("HellXXXYYYo World!", fs.to_s)
26
+ end
27
+
28
+ def test_fill
29
+ fs = FloatString.new( "Hello World!" )
30
+ fs.inner_insert("XXX", 4)
31
+ assert_equal("HeNNNN World!", fs.fill("N", 2..4))
32
+ end
33
+
34
+ end
35
+
36
+
@@ -0,0 +1,39 @@
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |_
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for lib/facets/more/functor.rb
8
+ #
9
+ # Extracted Fri Mar 24 23:42:50 UTC 2006
10
+ # Unit Tools Reap Test Extractor
11
+ #
12
+
13
+ require 'facets/more/functor.rb'
14
+
15
+
16
+ require 'test/unit'
17
+
18
+ class TC_Functor < Test::Unit::TestCase
19
+
20
+ def test_function
21
+ f = Functor.new { |op, x| x.send(op, x) }
22
+ assert_equal( 2, f + 1 ) #=> 2
23
+ assert_equal( 4, f + 2 ) #=> 4
24
+ assert_equal( 6, f + 3 ) #=> 6
25
+ assert_equal( 1, f * 1 ) #=> 1
26
+ assert_equal( 4, f * 2 ) #=> 4
27
+ assert_equal( 9, f * 3 ) #=> 9
28
+ end
29
+
30
+ def test_decoration
31
+ f = Functor.new("A") { |op, a, x| x.send(op, a + x) }
32
+ assert_equal( 'BAB', f + 'B' )
33
+ assert_equal( 'CAC', f + 'C' )
34
+ assert_equal( 'DAD', f + 'D' )
35
+ end
36
+
37
+ end
38
+
39
+
@@ -0,0 +1,155 @@
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |_
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for lib/facets/more/inheritor.rb
8
+ #
9
+ # Extracted Fri Mar 24 23:42:50 UTC 2006
10
+ # Unit Tools Reap Test Extractor
11
+ #
12
+
13
+ require 'facets/more/inheritor.rb'
14
+
15
+
16
+ require 'test/unit'
17
+
18
+ #class TC01 < Test::Unit::TestCase
19
+ # def setup
20
+ # @a = [1]
21
+ # @i = Inheritor.new( @a, [2], :+ )
22
+ # end
23
+ # def test_01_001
24
+ # assert_equal([2],@i)
25
+ # end
26
+ # def test_01_002
27
+ # assert_equal([1,2],@i.inheritance)
28
+ # end
29
+ #end
30
+
31
+ class TC02 < Test::Unit::TestCase
32
+ class C
33
+ inheritor :koko, [1], :+
34
+ end
35
+ class D < C
36
+ inheritor :koko, [2], :+
37
+ end
38
+
39
+ def test_02_001
40
+ assert_equal( [1], C.koko! )
41
+ end
42
+ def test_02_002
43
+ assert_equal( [1], C.koko )
44
+ end
45
+ def test_02_003
46
+ assert_equal( [2], D.koko! )
47
+ end
48
+ def test_02_004
49
+ assert_equal( [1,2], D.koko )
50
+ end
51
+ end
52
+
53
+ class TC03 < Test::Unit::TestCase
54
+ class C
55
+ inheritor :koko, [1], :+
56
+ end
57
+ class D < C
58
+ end
59
+
60
+ def test_03_001
61
+ assert_equal( [1], C.koko! )
62
+ end
63
+ def test_03_002
64
+ assert_equal( [1], C.koko )
65
+ end
66
+ def test_03_003
67
+ assert_equal( [], D.koko! )
68
+ end
69
+ def test_03_004
70
+ assert_equal( [1], D.koko )
71
+ end
72
+ end
73
+
74
+ class TC04 < Test::Unit::TestCase
75
+ class X
76
+ inheritor :x, {:a=>1}, :merge
77
+ end
78
+ module M
79
+ inheritor :x, {:b=>2}, :merge
80
+ end
81
+ class Y < X
82
+ include M
83
+ inheritor :x, {:c=>3}, :merge
84
+ end
85
+
86
+ def test_04_001
87
+ assert_equal( {:a=>1}, X.x )
88
+ end
89
+ def test_04_002
90
+ assert_equal( 2, M.x[:b] )
91
+ end
92
+ def test_04_003
93
+ assert_equal( {:a=>1,:b=>2,:c=>3}, Y.x )
94
+ end
95
+ def test_04_004
96
+ assert_equal( 1, X.x[:a] )
97
+ assert_equal( nil, X.x[:b] )
98
+ assert_equal( nil, X.x[:c] )
99
+ end
100
+ def test_04_005 ; assert_equal( 1, Y.x[:a] ) ; end
101
+ def test_04_006 ; assert_equal( 2, Y.x[:b] ) ; end
102
+ def test_04_007 ; assert_equal( 3, Y.x[:c] ) ; end
103
+ def test_04_008
104
+ Y.x![:d] = 4
105
+ assert_equal( 4, Y.x[:d] )
106
+ end
107
+ end
108
+
109
+ class TC05 < Test::Unit::TestCase
110
+ class C
111
+ inheritor :relations, [], :concat
112
+ end
113
+ class D < C
114
+ #inheritor :relations, [], :concat
115
+ end
116
+
117
+ C.relations! << 1
118
+ C.relations! << 2
119
+ D.relations! << 3
120
+
121
+ def test_05_001
122
+ assert_equal( [1,2], C.relations )
123
+ assert_equal( [1,2,3], D.relations )
124
+ end
125
+ end
126
+
127
+ class TC06 < Test::Unit::TestCase
128
+ module MM
129
+ inheritor :koko, [], :+
130
+ koko! << 1
131
+ end
132
+ class CC1
133
+ include MM
134
+ #inheritor :koko, [], :+
135
+ koko! << 2
136
+ koko! << 3
137
+ end
138
+ class CC2
139
+ include MM
140
+ #inheritor :koko, [], :+
141
+ koko! << 4
142
+ end
143
+
144
+ def test_06_001
145
+ assert_equal( [1], MM.koko )
146
+ end
147
+ def test_06_002
148
+ assert_equal( [1,2,3], CC1.koko )
149
+ end
150
+ def test_06_003
151
+ assert_equal( [1,4], CC2.koko )
152
+ end
153
+ end
154
+
155
+
@@ -0,0 +1,119 @@
1
+ # _____ _
2
+ # |_ _|__ ___| |_
3
+ # | |/ _ \/ __| __|
4
+ # | | __/\__ \ |_
5
+ # |_|\___||___/\__|
6
+ #
7
+ # for lib/facets/more/interval.rb
8
+ #
9
+ # Extracted Fri Mar 24 23:42:50 UTC 2006
10
+ # Unit Tools Reap Test Extractor
11
+ #
12
+
13
+ require 'facets/more/interval.rb'
14
+
15
+
16
+ require 'test/unit'
17
+
18
+ class InclusiveTest < Test::Unit::TestCase
19
+
20
+ def setup
21
+ @a = Interval.new( 1, 10 )
22
+ @b = Interval.new( 1, 10, true, false )
23
+ @c = Interval.new( 1, 10, false, true )
24
+ @d = Interval.new( 1, 10, true, true )
25
+ end
26
+
27
+ def test_001A ; assert_equal( false, @a.include?(0) ) ; end
28
+ def test_002A ; assert_equal( true, @a.include?(1) ) ; end
29
+ def test_003A ; assert_equal( true, @a.include?(2) ) ; end
30
+ def test_004A ; assert_equal( true, @a.include?(9) ) ; end
31
+ def test_005A ; assert_equal( true, @a.include?(10) ) ; end
32
+ def test_006A ; assert_equal( false, @a.include?(11) ) ; end
33
+
34
+ def test_001B ; assert_equal( false, @b.include?(0) ) ; end
35
+ def test_002B ; assert_equal( false, @b.include?(1) ) ; end
36
+ def test_003B ; assert_equal( true, @b.include?(2) ) ; end
37
+ def test_004B ; assert_equal( true, @b.include?(9) ) ; end
38
+ def test_005B ; assert_equal( true, @b.include?(10) ) ; end
39
+ def test_006B ; assert_equal( false, @b.include?(11) ) ; end
40
+
41
+ def test_001C ; assert_equal( false, @c.include?(0) ) ; end
42
+ def test_002C ; assert_equal( true, @c.include?(1) ) ; end
43
+ def test_003C ; assert_equal( true, @c.include?(2) ) ; end
44
+ def test_004C ; assert_equal( true, @c.include?(9) ) ; end
45
+ def test_005C ; assert_equal( false, @c.include?(10) ) ; end
46
+ def test_006C ; assert_equal( false, @c.include?(11) ) ; end
47
+
48
+ def test_001D ; assert_equal( false, @d.include?(0) ) ; end
49
+ def test_002D ; assert_equal( false, @d.include?(1) ) ; end
50
+ def test_003D ; assert_equal( true, @d.include?(2) ) ; end
51
+ def test_004D ; assert_equal( true, @d.include?(9) ) ; end
52
+ def test_005D ; assert_equal( false, @d.include?(10) ) ; end
53
+ def test_006D ; assert_equal( false, @d.include?(11) ) ; end
54
+
55
+ end
56
+
57
+ class LrgNumericTest < Test::Unit::TestCase
58
+
59
+ def setup
60
+ @a = Interval.new(0,100000000)
61
+ @b = Interval.new(0,100000000)
62
+ end
63
+
64
+ def test_001A ; assert_equal( true, @a.include?(0) ) ; end
65
+ def test_002A ; assert_equal( true, @a.include?(1000) ) ; end
66
+ def test_003A ; assert_equal( true, @a.include?(1000000) ) ; end
67
+ def test_004A ; assert_equal( true, @a.include?(100000000) ) ; end
68
+ #def test_005A ; assert_equal( false, @a.include?(INFINITY) ) ; end
69
+
70
+ def test_001B ; assert_equal( true, @b.include?(0) ) ; end
71
+ def test_002B ; assert_equal( true, @b.include?(5) ) ; end
72
+ def test_002B ; assert_equal( true, @b.include?(70007) ) ; end
73
+ def test_002B ; assert_equal( true, @b.include?(5000005) ) ; end
74
+ #def test_002B ; assert_equal( false, @b.include?(INFINITY) ) ; end
75
+
76
+ end
77
+
78
+ class SelectTest < Test::Unit::TestCase
79
+
80
+ def setup
81
+ @a = Interval.new( 0,10 )
82
+ end
83
+
84
+ def test_001
85
+ b = @a.collect( 2 ){ |n| n }
86
+ assert_equal( [0,2,4,6,8,10], b )
87
+ end
88
+
89
+ def test_002
90
+ b = @a.select{ |n| n % 2 == 0 }
91
+ assert_equal( [0,2,4,6,8,10], b )
92
+ end
93
+
94
+ def test_003
95
+ b = @a.collect( 1,2 ){ |n| n }
96
+ assert_equal( [0,5,10], b )
97
+ end
98
+
99
+ def test_004
100
+ b = @a.select( 1,2 ){ |n| n % 2 == 0 }
101
+ assert_equal( [0,10], b )
102
+ end
103
+
104
+ end
105
+
106
+ class ArrayTest < Test::Unit::TestCase
107
+
108
+ def setup
109
+ @a = Interval.new( 0,10 )
110
+ @b = Interval.new( 0,1 )
111
+ end
112
+
113
+ def test_001A ; assert_equal( [0,5,10], @a.to_a(1,2) ) ; end
114
+
115
+ def test_001B ; assert_equal( [0, 0.25, 0.5, 0.75, 1.0], @b.to_a(1,4) ) ; end
116
+
117
+ end
118
+
119
+