AbstInt
AbstInt provide abstract integer. This can be used to test exhaustively.
Installation
Add this line to your application's Gemfile:
gem 'abst_int'
And then execute:
$ bundle
Or install it yourself as:
$ gem install abst_int
Usage
abst2 = (AbstInt.new * 2).object # 2の倍数
abst3 = (AbstInt.new * 3).object # 3の倍数
abst2 % 2 #=> 0
abst3 % 3 #=> 0
abst2 % 3 #=> AbstInt::MultiResultError
(abst2 + 1) % 2 #=> 1
abst2_and_3 = ((AbstInt.new * 2) & (AbstInt.new * 3)).object # 2の倍数かつ3の倍数
abst2_and_3 % 6 #=> 0
abst2_and_3 % 2 #=> 0
abst2_and_3 % 3 #=> 0
not_abst3 = (AbstInt.new * 3).not.object # 3の倍数でない
not_abst3 % 3 #=> 1 or 2 を表現するオブジェクト
not_abst3 % 3 == 0 #=> false
not_abst3 % 3 == 1 #=> AbstInt::MultiResultError
Contributing
- Fork it ( https://github.com/[my-github-username]/abst_int/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request