abst_int 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ class AbstInt::Variable
2
+ attr_reader :id
3
+ @@id = 0
4
+
5
+ def initialize
6
+ @id = @@id
7
+ @@id += 1
8
+ end
9
+
10
+ def <=> variable
11
+ return nil unless variable.instance_of? AbstInt::Variable
12
+ return (@id <=> variable.id)
13
+ end
14
+
15
+ def to_s
16
+ "x_#{@id}"
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ class AbstInt
2
+ VERSION = "0.0.3"
3
+ end
@@ -0,0 +1,10 @@
1
+ # stack level too deep
2
+ # class Fixnum
3
+ # def mul_with_abst_int num
4
+ # return num * self if (num.is_a? AbstInt) || (num.is_a? AbstInt::Integer)
5
+ # self.mul_without_abst_int num
6
+ # end
7
+
8
+ # alias :mul_without_abst_int :*
9
+ # alias :* :mul_with_abst_int
10
+ # end
@@ -0,0 +1,37 @@
1
+ require "spec_helper"
2
+ require "pry"
3
+
4
+ describe AbstInt do
5
+ let(:ai2) { (AbstInt.new * 2).object }
6
+ let(:ai3) { (AbstInt.new * 3).object }
7
+ let(:ai6) { ((AbstInt.new * 2) * (AbstInt.new * 3)).object }
8
+ let(:ai6_1) { ai6 + 1 }
9
+ let(:ai6__1) { ai6 - 1 }
10
+ let(:ai6_2) { ai3 + ai3 }
11
+ let(:ai6_3) { ((AbstInt.new * 3) & (AbstInt.new * 5)).object }
12
+ let(:ai6_4) { (AbstInt.new * 3 + 1).not.object }
13
+
14
+ it { expect(ai2 % 2).to eq 0 }
15
+ it { expect(ai3 % 3).to eq 0 }
16
+ it { expect(ai6 % 2).to eq 0 }
17
+ it { expect(ai6 % 3).to eq 0 }
18
+ it { expect(ai6 % 6).to eq 0 }
19
+ it { expect(ai6_1 % 2).to eq 1 }
20
+ it { expect(ai6_1 % 3).to eq 1 }
21
+ it { expect(ai6_1 % 6).to eq 1 }
22
+ it { expect(ai6__1 % 2).to eq 1 }
23
+ it { expect(ai6__1 % 3).to eq 2 }
24
+ it { expect(ai6__1 % 6).to eq 5 }
25
+ it { expect(ai6_2 % 6).to eq 0 }
26
+ it { expect(ai6_3 % 3).to eq 0 }
27
+ it { expect(ai6_3 % 5).to eq 0 }
28
+ it { expect(ai6_4 % 3).not_to eq 1 }
29
+
30
+ describe "#to_s" do
31
+ it { expect(ai6.to_s).to match /6x/ }
32
+ end
33
+
34
+ describe "#/" do
35
+ it { expect{AbstInt.new / 2}.to raise_error }
36
+ end
37
+ end
@@ -0,0 +1,94 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ require 'simplecov'
13
+ require 'coveralls'
14
+
15
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
16
+ SimpleCov::Formatter::HTMLFormatter,
17
+ Coveralls::SimpleCov::Formatter
18
+ ]
19
+ SimpleCov.start do
20
+ add_filter '.bundle/'
21
+ end
22
+
23
+ $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
24
+ $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
25
+ require 'abst_int'
26
+ require 'rspec'
27
+
28
+ #
29
+ # The `.rspec` file also contains a few flags that are not defaults but that
30
+ # users commonly want.
31
+ #
32
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
33
+ RSpec.configure do |config|
34
+ # The settings below are suggested to provide a good initial experience
35
+ # with RSpec, but feel free to customize to your heart's content.
36
+ =begin
37
+ # These two settings work together to allow you to limit a spec run
38
+ # to individual examples or groups you care about by tagging them with
39
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
40
+ # get run.
41
+ config.filter_run :focus
42
+ config.run_all_when_everything_filtered = true
43
+
44
+ # Many RSpec users commonly either run the entire suite or an individual
45
+ # file, and it's useful to allow more verbose output when running an
46
+ # individual spec file.
47
+ if config.files_to_run.one?
48
+ # Use the documentation formatter for detailed output,
49
+ # unless a formatter has already been configured
50
+ # (e.g. via a command-line flag).
51
+ config.default_formatter = 'doc'
52
+ end
53
+
54
+ # Print the 10 slowest examples and example groups at the
55
+ # end of the spec run, to help surface which specs are running
56
+ # particularly slow.
57
+ config.profile_examples = 10
58
+
59
+ # Run specs in random order to surface order dependencies. If you find an
60
+ # order dependency and want to debug it, you can fix the order by providing
61
+ # the seed, which is printed after each run.
62
+ # --seed 1234
63
+ config.order = :random
64
+
65
+ # Seed global randomization in this process using the `--seed` CLI option.
66
+ # Setting this allows you to use `--seed` to deterministically reproduce
67
+ # test failures related to randomization by passing the same `--seed` value
68
+ # as the one that triggered the failure.
69
+ Kernel.srand config.seed
70
+
71
+ # rspec-expectations config goes here. You can use an alternate
72
+ # assertion/expectation library such as wrong or the stdlib/minitest
73
+ # assertions if you prefer.
74
+ config.expect_with :rspec do |expectations|
75
+ # Enable only the newer, non-monkey-patching expect syntax.
76
+ # For more details, see:
77
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
78
+ expectations.syntax = :expect
79
+ end
80
+
81
+ # rspec-mocks config goes here. You can use an alternate test double
82
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
83
+ config.mock_with :rspec do |mocks|
84
+ # Enable only the newer, non-monkey-patching expect syntax.
85
+ # For more details, see:
86
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
87
+ mocks.syntax = :expect
88
+
89
+ # Prevents you from mocking or stubbing a method that does not exist on
90
+ # a real object. This is generally recommended.
91
+ mocks.verify_partial_doubles = true
92
+ end
93
+ =end
94
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: abst_int
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Yuutetu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-doc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: AbstInt provide abstract integer. This can be used to test exhaustively.
84
+ email:
85
+ - yuutetu@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".coveralls.yml"
91
+ - ".gitignore"
92
+ - ".pryrc"
93
+ - ".rspec"
94
+ - ".ruby-version"
95
+ - ".travis.yml"
96
+ - Gemfile
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - abst_int.gemspec
101
+ - lib/abst_int.rb
102
+ - lib/abst_int/calculus_model/dfa.rb
103
+ - lib/abst_int/calculus_model/nfa.rb
104
+ - lib/abst_int/collection.rb
105
+ - lib/abst_int/integer.rb
106
+ - lib/abst_int/or_set.rb
107
+ - lib/abst_int/set.rb
108
+ - lib/abst_int/term.rb
109
+ - lib/abst_int/variable.rb
110
+ - lib/abst_int/version.rb
111
+ - lib/fixnum.rb
112
+ - spec/abst_int_spec.rb
113
+ - spec/spec_helper.rb
114
+ homepage: https://github.com/yuutetu/abst_int
115
+ licenses:
116
+ - MIT
117
+ metadata: {}
118
+ post_install_message:
119
+ rdoc_options: []
120
+ require_paths:
121
+ - lib
122
+ required_ruby_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ requirements: []
133
+ rubyforge_project:
134
+ rubygems_version: 2.2.2
135
+ signing_key:
136
+ specification_version: 4
137
+ summary: Abstract Integer
138
+ test_files:
139
+ - spec/abst_int_spec.rb
140
+ - spec/spec_helper.rb
141
+ has_rdoc: