casegen 2.0.0 → 3.0.1

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +109 -0
  4. data/.ruby-version +1 -1
  5. data/Gemfile +3 -1
  6. data/Gemfile.lock +63 -6
  7. data/README.md +10 -119
  8. data/Rakefile +9 -7
  9. data/bin/casegen +2 -1
  10. data/casegen.gemspec +13 -9
  11. data/doc/bounding_box.rb +37 -0
  12. data/doc/cart.rb +43 -0
  13. data/doc/expect_only.rb +28 -0
  14. data/doc/pricing.rb +50 -0
  15. data/doc/ruby_array.rb +41 -0
  16. data/lib/case_gen/combination.rb +38 -0
  17. data/lib/case_gen/combo_matcher.rb +15 -0
  18. data/lib/case_gen/exclude_rule.rb +50 -0
  19. data/lib/case_gen/expect_rule.rb +24 -0
  20. data/lib/case_gen/generator.rb +40 -0
  21. data/lib/case_gen/output/exclude.rb +6 -0
  22. data/lib/case_gen/output/exclude_as_table.rb +13 -0
  23. data/lib/case_gen/output/exclude_as_text.rb +12 -0
  24. data/lib/case_gen/output/exclude_inline.rb +13 -0
  25. data/lib/case_gen/output/exclude_inline_footnotes.rb +20 -0
  26. data/lib/case_gen/output.rb +66 -0
  27. data/lib/case_gen/rule_description.rb +11 -0
  28. data/lib/case_gen/set.rb +16 -0
  29. data/lib/casegen.rb +15 -183
  30. data/spec/cart_sample_spec.rb +46 -0
  31. data/spec/case_gen/combination_spec.rb +11 -0
  32. data/spec/case_gen/exclude_rule_spec.rb +17 -0
  33. data/spec/exclude_as_table_spec.rb +39 -0
  34. data/spec/exclude_as_text_spec.rb +58 -0
  35. data/spec/exclude_inline_footnotes_spec.rb +58 -0
  36. data/spec/exclude_inline_spec.rb +50 -0
  37. data/spec/expect_only_spec.rb +30 -0
  38. data/spec/spec_helper.rb +113 -0
  39. metadata +103 -40
  40. data/.idea/encodings.xml +0 -5
  41. data/.idea/misc.xml +0 -5
  42. data/.idea/modules.xml +0 -9
  43. data/.idea/vcs.xml +0 -7
  44. data/doc/calc.sample.txt +0 -13
  45. data/doc/cart.sample.rb +0 -3
  46. data/doc/cart.sample.txt +0 -33
  47. data/doc/ruby_array.sample.rb +0 -26
  48. data/lib/agents/sets/enum/by.rb +0 -244
  49. data/lib/agents/sets/enum/cluster.rb +0 -164
  50. data/lib/agents/sets/enum/inject.rb +0 -50
  51. data/lib/agents/sets/enum/nest.rb +0 -117
  52. data/lib/agents/sets/enum/op.rb +0 -283
  53. data/lib/agents/sets/enum/pipe.rb +0 -160
  54. data/lib/agents/sets/enum/tree.rb +0 -442
  55. data/lib/agents/sets.rb +0 -313
  56. data/test/agents/console_output_test.rb +0 -27
  57. data/test/agents/sets.test.rb +0 -227
  58. data/test/agents_test.rb +0 -41
  59. data/test/casegen.tests.rb +0 -0
  60. data/test/parser_test.rb +0 -163
  61. data/test/test_helper.rb +0 -2
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require_relative '../doc/pricing'
5
+
6
+ RSpec.describe 'Exclude inline with footnotes' do
7
+ let(:expected_table) do
8
+ <<~_
9
+ +----------+----------+-------+--------+---------+
10
+ | subtotal | discount | promo | total | exclude |
11
+ +----------+----------+-------+--------+---------+
12
+ | 25 | 0% | none | 25.00 | |
13
+ | 25 | 0% | apr | 17.50 | |
14
+ | 25 | 0% | fall | 16.25 | |
15
+ | 25 | 10% | none | | [2] |
16
+ | 25 | 10% | apr | | [2] |
17
+ | 25 | 10% | fall | | [2] |
18
+ | 25 | 20% | none | | [1] |
19
+ | 25 | 20% | apr | | [1] |
20
+ | 25 | 20% | fall | | [1] |
21
+ | 75 | 0% | none | | [4] |
22
+ | 75 | 0% | apr | | [4] |
23
+ | 75 | 0% | fall | | [4] |
24
+ | 75 | 10% | none | 67.50 | |
25
+ | 75 | 10% | apr | 47.25 | |
26
+ | 75 | 10% | fall | 43.88 | |
27
+ | 75 | 20% | none | | [1] |
28
+ | 75 | 20% | apr | | [1] |
29
+ | 75 | 20% | fall | | [1] |
30
+ | 200 | 0% | none | | [3] |
31
+ | 200 | 0% | apr | | [3] |
32
+ | 200 | 0% | fall | | [3] |
33
+ | 200 | 10% | none | | [3] |
34
+ | 200 | 10% | apr | | [3] |
35
+ | 200 | 10% | fall | | [3] |
36
+ | 200 | 20% | none | 160.00 | |
37
+ | 200 | 20% | apr | | [5] |
38
+ | 200 | 20% | fall | | [5] |
39
+ +----------+----------+-------+--------+---------+
40
+
41
+ exclude
42
+ -------
43
+ [1] Total must be above $100 to apply the 20% discount
44
+ [2] Total must be above $50 to apply the 10% discount
45
+ [3] Orders over 100 automatically get 20% discount
46
+ [4] Orders between 50 and 100 automatically get 10% discount
47
+ [5] 20% discount cannot be combined with promo
48
+ _
49
+ end
50
+
51
+ let(:sets) { Fixtures[:pricing][:sets] }
52
+ let(:rules) { Fixtures[:pricing][:rules] }
53
+
54
+ it 'output' do
55
+ result = CaseGen.generate(sets, rules, :exclude_inline_footnotes)
56
+ expect(result).to eq expected_table.chomp
57
+ end
58
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require_relative '../doc/pricing'
5
+
6
+ RSpec.describe 'Exclude inline' do
7
+ let(:expected_table) do
8
+ <<~_
9
+ +----------+----------+-------+--------+----------------------------------------------------------+
10
+ | subtotal | discount | promo | total | exclude |
11
+ +----------+----------+-------+--------+----------------------------------------------------------+
12
+ | 25 | 0% | none | 25.00 | |
13
+ | 25 | 0% | apr | 17.50 | |
14
+ | 25 | 0% | fall | 16.25 | |
15
+ | 25 | 10% | none | | Total must be above $50 to apply the 10% discount |
16
+ | 25 | 10% | apr | | Total must be above $50 to apply the 10% discount |
17
+ | 25 | 10% | fall | | Total must be above $50 to apply the 10% discount |
18
+ | 25 | 20% | none | | Total must be above $100 to apply the 20% discount |
19
+ | 25 | 20% | apr | | Total must be above $100 to apply the 20% discount |
20
+ | 25 | 20% | fall | | Total must be above $100 to apply the 20% discount |
21
+ | 75 | 0% | none | | Orders between 50 and 100 automatically get 10% discount |
22
+ | 75 | 0% | apr | | Orders between 50 and 100 automatically get 10% discount |
23
+ | 75 | 0% | fall | | Orders between 50 and 100 automatically get 10% discount |
24
+ | 75 | 10% | none | 67.50 | |
25
+ | 75 | 10% | apr | 47.25 | |
26
+ | 75 | 10% | fall | 43.88 | |
27
+ | 75 | 20% | none | | Total must be above $100 to apply the 20% discount |
28
+ | 75 | 20% | apr | | Total must be above $100 to apply the 20% discount |
29
+ | 75 | 20% | fall | | Total must be above $100 to apply the 20% discount |
30
+ | 200 | 0% | none | | Orders over 100 automatically get 20% discount |
31
+ | 200 | 0% | apr | | Orders over 100 automatically get 20% discount |
32
+ | 200 | 0% | fall | | Orders over 100 automatically get 20% discount |
33
+ | 200 | 10% | none | | Orders over 100 automatically get 20% discount |
34
+ | 200 | 10% | apr | | Orders over 100 automatically get 20% discount |
35
+ | 200 | 10% | fall | | Orders over 100 automatically get 20% discount |
36
+ | 200 | 20% | none | 160.00 | |
37
+ | 200 | 20% | apr | | 20% discount cannot be combined with promo |
38
+ | 200 | 20% | fall | | 20% discount cannot be combined with promo |
39
+ +----------+----------+-------+--------+----------------------------------------------------------+
40
+ _
41
+ end
42
+
43
+ let(:sets) { Fixtures[:pricing][:sets] }
44
+ let(:rules) { Fixtures[:pricing][:rules] }
45
+
46
+ it 'output' do
47
+ result = CaseGen.generate(sets, rules, :exclude_inline)
48
+ expect(result).to eq expected_table
49
+ end
50
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+ require_relative '../doc/expect_only'
5
+
6
+ RSpec.describe 'Exclude as table' do
7
+ let(:expected_combo_table) do
8
+ <<~_
9
+ +----------+------+--------+
10
+ | duration | unit | result |
11
+ +----------+------+--------+
12
+ | 12 | 60 | 12m |
13
+ | 12 | 3600 | 12h |
14
+ | 24 | 60 | 24m |
15
+ | 24 | 3600 | 1d |
16
+ | 36 | 60 | 36m |
17
+ | 36 | 3600 | 1d 12h |
18
+ | 60 | 60 | 1h |
19
+ | 60 | 3600 | 2d 12h |
20
+ +----------+------+--------+
21
+ _
22
+ end
23
+
24
+ let(:fix) { Fixtures[:duration] }
25
+
26
+ it 'output' do
27
+ output = CaseGen.generate(fix[:sets], fix[:rules], :exclude_inline)
28
+ expect(output.to_s).to eq expected_combo_table
29
+ end
30
+ end
@@ -0,0 +1,113 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by the `rspec --init` command. Conventionally, all
4
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
5
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
6
+ # this file to always be loaded, without a need to explicitly require it in any
7
+ # files.
8
+ #
9
+ # Given that it is always loaded, you are encouraged to keep this file as
10
+ # light-weight as possible. Requiring heavyweight dependencies from this file
11
+ # will add to the boot time of your test suite on EVERY test run, even for an
12
+ # individual file that may not need all of that loaded. Instead, consider making
13
+ # a separate helper file that requires the additional dependencies and performs
14
+ # the additional setup, and require it from the spec files that actually need
15
+ # it.
16
+ #
17
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
18
+ RSpec.configure do |config|
19
+ # rspec-expectations config goes here. You can use an alternate
20
+ # assertion/expectation library such as wrong or the stdlib/minitest
21
+ # assertions if you prefer.
22
+ config.expect_with :rspec do |expectations|
23
+ # This option will default to `true` in RSpec 4. It makes the `description`
24
+ # and `failure_message` of custom matchers include text for helper methods
25
+ # defined using `chain`, e.g.:
26
+ # be_bigger_than(2).and_smaller_than(4).description
27
+ # # => "be bigger than 2 and smaller than 4"
28
+ # ...rather than:
29
+ # # => "be bigger than 2"
30
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
31
+ end
32
+
33
+ # rspec-mocks config goes here. You can use an alternate test double
34
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
35
+ config.mock_with :rspec do |mocks|
36
+ # Prevents you from mocking or stubbing a method that does not exist on
37
+ # a real object. This is generally recommended, and will default to
38
+ # `true` in RSpec 4.
39
+ mocks.verify_partial_doubles = true
40
+ end
41
+
42
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
43
+ # have no way to turn it off -- the option exists only for backwards
44
+ # compatibility in RSpec 3). It causes shared context metadata to be
45
+ # inherited by the metadata hash of host groups and examples, rather than
46
+ # triggering implicit auto-inclusion in groups with matching metadata.
47
+ config.shared_context_metadata_behavior = :apply_to_host_groups
48
+
49
+ # The settings below are suggested to provide a good initial experience
50
+ # with RSpec, but feel free to customize to your heart's content.
51
+ =begin
52
+ # This allows you to limit a spec run to individual examples or groups
53
+ # you care about by tagging them with `:focus` metadata. When nothing
54
+ # is tagged with `:focus`, all examples get run. RSpec also provides
55
+ # aliases for `it`, `describe`, and `context` that include `:focus`
56
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
57
+ config.filter_run_when_matching :focus
58
+
59
+ # Allows RSpec to persist some state between runs in order to support
60
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
61
+ # you configure your source control system to ignore this file.
62
+ config.example_status_persistence_file_path = "spec/examples.txt"
63
+
64
+ # Limits the available syntax to the non-monkey patched syntax that is
65
+ # recommended. For more details, see:
66
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
67
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
68
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
69
+ config.disable_monkey_patching!
70
+
71
+ # This setting enables warnings. It's recommended, but in some cases may
72
+ # be too noisy due to issues in dependencies.
73
+ config.warnings = true
74
+
75
+ # Many RSpec users commonly either run the entire suite or an individual
76
+ # file, and it's useful to allow more verbose output when running an
77
+ # individual spec file.
78
+ if config.files_to_run.one?
79
+ # Use the documentation formatter for detailed output,
80
+ # unless a formatter has already been configured
81
+ # (e.g. via a command-line flag).
82
+ config.default_formatter = "doc"
83
+ end
84
+
85
+ # Print the 10 slowest examples and example groups at the
86
+ # end of the spec run, to help surface which specs are running
87
+ # particularly slow.
88
+ config.profile_examples = 10
89
+
90
+ # Run specs in random order to surface order dependencies. If you find an
91
+ # order dependency and want to debug it, you can fix the order by providing
92
+ # the seed, which is printed after each run.
93
+ # --seed 1234
94
+ config.order = :random
95
+
96
+ # Seed global randomization in this process using the `--seed` CLI option.
97
+ # Setting this allows you to use `--seed` to deterministically reproduce
98
+ # test failures related to randomization by passing the same `--seed` value
99
+ # as the one that triggered the failure.
100
+ Kernel.srand config.seed
101
+ =end
102
+ end
103
+
104
+ class Fixtures
105
+ def self.add(name, sets, rules)
106
+ @fixtures ||= {}
107
+ @fixtures[name] = {sets: sets, rules: rules}
108
+ end
109
+
110
+ def self.[](name)
111
+ @fixtures[name]
112
+ end
113
+ end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casegen
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - chrismo
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2019-04-05 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: tablesmith
@@ -25,7 +24,7 @@ dependencies:
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0'
27
26
  - !ruby/object:Gem::Dependency
28
- name: minitest
27
+ name: rake
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
@@ -39,7 +38,35 @@ dependencies:
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
40
  - !ruby/object:Gem::Dependency
42
- name: rake
41
+ name: rspec
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :development
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rubocop
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: rubocop-performance
43
70
  requirement: !ruby/object:Gem::Requirement
44
71
  requirements:
45
72
  - - ">="
@@ -52,7 +79,35 @@ dependencies:
52
79
  - - ">="
53
80
  - !ruby/object:Gem::Version
54
81
  version: '0'
55
- description: Simple Ruby DSL to generate use cases restricted by sets of rules
82
+ - !ruby/object:Gem::Dependency
83
+ name: rubocop-rake
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ - !ruby/object:Gem::Dependency
97
+ name: rubocop-rspec
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Simple tool to generate use cases restricted by sets of rules
56
111
  email: chrismo@clabs.org
57
112
  executables:
58
113
  - casegen
@@ -60,10 +115,8 @@ extensions: []
60
115
  extra_rdoc_files: []
61
116
  files:
62
117
  - ".gitignore"
63
- - ".idea/encodings.xml"
64
- - ".idea/misc.xml"
65
- - ".idea/modules.xml"
66
- - ".idea/vcs.xml"
118
+ - ".rspec"
119
+ - ".rubocop.yml"
67
120
  - ".ruby-version"
68
121
  - Gemfile
69
122
  - Gemfile.lock
@@ -73,52 +126,62 @@ files:
73
126
  - TODO
74
127
  - bin/casegen
75
128
  - casegen.gemspec
76
- - doc/calc.sample.txt
77
- - doc/cart.sample.rb
78
- - doc/cart.sample.txt
79
- - doc/ruby_array.sample.rb
80
- - lib/agents/sets.rb
81
- - lib/agents/sets/enum/by.rb
82
- - lib/agents/sets/enum/cluster.rb
83
- - lib/agents/sets/enum/inject.rb
84
- - lib/agents/sets/enum/nest.rb
85
- - lib/agents/sets/enum/op.rb
86
- - lib/agents/sets/enum/pipe.rb
87
- - lib/agents/sets/enum/tree.rb
129
+ - doc/bounding_box.rb
130
+ - doc/cart.rb
131
+ - doc/expect_only.rb
132
+ - doc/pricing.rb
133
+ - doc/ruby_array.rb
134
+ - lib/case_gen/combination.rb
135
+ - lib/case_gen/combo_matcher.rb
136
+ - lib/case_gen/exclude_rule.rb
137
+ - lib/case_gen/expect_rule.rb
138
+ - lib/case_gen/generator.rb
139
+ - lib/case_gen/output.rb
140
+ - lib/case_gen/output/exclude.rb
141
+ - lib/case_gen/output/exclude_as_table.rb
142
+ - lib/case_gen/output/exclude_as_text.rb
143
+ - lib/case_gen/output/exclude_inline.rb
144
+ - lib/case_gen/output/exclude_inline_footnotes.rb
145
+ - lib/case_gen/rule_description.rb
146
+ - lib/case_gen/set.rb
88
147
  - lib/casegen.rb
89
- - test/agents/console_output_test.rb
90
- - test/agents/sets.test.rb
91
- - test/agents_test.rb
92
- - test/casegen.tests.rb
93
- - test/parser_test.rb
94
- - test/test_helper.rb
148
+ - spec/cart_sample_spec.rb
149
+ - spec/case_gen/combination_spec.rb
150
+ - spec/case_gen/exclude_rule_spec.rb
151
+ - spec/exclude_as_table_spec.rb
152
+ - spec/exclude_as_text_spec.rb
153
+ - spec/exclude_inline_footnotes_spec.rb
154
+ - spec/exclude_inline_spec.rb
155
+ - spec/expect_only_spec.rb
156
+ - spec/spec_helper.rb
95
157
  homepage: https://github.com/chrismo/casegen
96
158
  licenses:
97
159
  - MIT
98
160
  metadata: {}
99
- post_install_message:
100
161
  rdoc_options: []
101
162
  require_paths:
102
163
  - lib
103
164
  required_ruby_version: !ruby/object:Gem::Requirement
104
165
  requirements:
105
- - - "~>"
166
+ - - ">="
106
167
  - !ruby/object:Gem::Version
107
- version: '2.3'
168
+ version: '2.5'
108
169
  required_rubygems_version: !ruby/object:Gem::Requirement
109
170
  requirements:
110
171
  - - ">="
111
172
  - !ruby/object:Gem::Version
112
173
  version: '0'
113
174
  requirements: []
114
- rubygems_version: 3.0.3
115
- signing_key:
175
+ rubygems_version: 3.6.9
116
176
  specification_version: 4
117
- summary: Simple Ruby DSL to generate use cases restricted by sets of rules
177
+ summary: Simple tool to generate use cases restricted by sets of rules
118
178
  test_files:
119
- - test/agents/console_output_test.rb
120
- - test/agents/sets.test.rb
121
- - test/agents_test.rb
122
- - test/casegen.tests.rb
123
- - test/parser_test.rb
124
- - test/test_helper.rb
179
+ - spec/cart_sample_spec.rb
180
+ - spec/case_gen/combination_spec.rb
181
+ - spec/case_gen/exclude_rule_spec.rb
182
+ - spec/exclude_as_table_spec.rb
183
+ - spec/exclude_as_text_spec.rb
184
+ - spec/exclude_inline_footnotes_spec.rb
185
+ - spec/exclude_inline_spec.rb
186
+ - spec/expect_only_spec.rb
187
+ - spec/spec_helper.rb
data/.idea/encodings.xml DELETED
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
- </project>
5
-
data/.idea/misc.xml DELETED
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="ruby-1.9.2-p180" project-jdk-type="RUBY_SDK" />
4
- </project>
5
-
data/.idea/modules.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/casegen.iml" filepath="$PROJECT_DIR$/.idea/casegen.iml" />
6
- </modules>
7
- </component>
8
- </project>
9
-
data/.idea/vcs.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
7
-
data/doc/calc.sample.txt DELETED
@@ -1,13 +0,0 @@
1
- sets
2
- ----
3
- first number: 0, 1
4
- operator: +, -, *, /
5
- second number: 0, 1
6
-
7
- rules(sets)
8
- -----------
9
- exclude operator = / AND second number = 0
10
- Divide by zero error
11
-
12
- console(rules)
13
- --------------
data/doc/cart.sample.rb DELETED
@@ -1,3 +0,0 @@
1
- require_relative '../lib/casegen'
2
-
3
- CLabs::CaseGen::CaseGen.new(File.read(File.join(__dir__, 'cart.sample.txt')))
data/doc/cart.sample.txt DELETED
@@ -1,33 +0,0 @@
1
- sets
2
- ------------
3
- payment: Credit, Check, Online Bank
4
- amount: 100, 1,000, 10,000
5
- shipping: Ground, Air
6
- ship to country: US, Outside US
7
- bill to country: US, Outside US
8
-
9
-
10
- rules(sets)
11
- ---------------------------
12
- # Comments supported
13
- exclude shipping = Ground AND ship to country = Outside US
14
- Our ground shipper will only ship things within the US.
15
-
16
- # Single or double equals sign supported - they're synonymous
17
- exclude payment = Check AND bill to country == Outside US
18
- Our bank will not accept checks written from banks outside the US.
19
-
20
- #[Complex booleans not supported yet]
21
- #exclude payment = Online Bank AND (amount == 1,000 OR amount = 10,000)
22
- exclude payment = Online Bank AND amount == 1,000
23
- exclude payment = Online Bank AND amount == 10,000
24
- While the online bank will process amounts > $1,000, we've experienced
25
- occasional problems with their services and have had to write off some
26
- transactions, so we no longer allow this payment option for amounts greater
27
- than $1,000
28
-
29
- exclude ship to country = US AND bill to country = Outside US
30
- If we're shipping to the US, billing party cannot be outside US
31
-
32
- console(rules)
33
- ----------
@@ -1,26 +0,0 @@
1
- require_relative '../lib/casegen'
2
-
3
- CLabs::CaseGen::CaseGen.new(DATA.read)
4
-
5
- __END__
6
-
7
- sets
8
- ----
9
- role: admin, standard
10
- authorization code: none, invalid, valid
11
- submit enabled: true, false
12
-
13
- rules(sets)
14
- -----------
15
- exclude role = admin AND submit enabled = false
16
- Admin role can always submit
17
-
18
- exclude role = standard AND authorization code = none AND submit enabled = true
19
- exclude role = standard AND authorization code = invalid AND submit enabled = true
20
- exclude role = standard AND authorization code = valid AND submit enabled = false
21
- Standard role can only submit when authorization code is valid
22
-
23
-
24
- ruby_array(rules)
25
- -------------
26
- DataSubmitCase