test_values 0.1.0.pre → 0.2.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +7 -43
- data/lib/test_values.rb +3 -1
- data/lib/test_values/string_values.rb +57 -0
- data/lib/test_values/values_base.rb +9 -0
- data/lib/test_values/version.rb +2 -2
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d70c7bfe9b941510702219a97cb6dbd10135c1ab
|
4
|
+
data.tar.gz: 337503957c0b9b80233ab2d2b24f161269457480
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 848d62c01a29a9f912cedf4e3300625025d4792c3fbe4a14847caac37b276e4d7b8c2bf118dc58e4535c8b18e6c603f67053c90e2d767e3485ba1357d7b3529e
|
7
|
+
data.tar.gz: 6ae2b10eddcf9e39421bc263f3b88ab01fb30d347ad4fc1aa6460b2064d8b21cb98c309958fd0cc8c523a0bd5fec416f85902ba7398506b1fd7109455032a434
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,43 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'test_values'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install test_values
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/test_values. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
-
|
37
|
-
## License
|
38
|
-
|
39
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
|
-
|
41
|
-
## Code of Conduct
|
42
|
-
|
43
|
-
Everyone interacting in the TestValues project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/test_values/blob/master/CODE_OF_CONDUCT.md).
|
1
|
+
# Test Values
|
2
|
+
|
3
|
+
Project to support generation of values for testing software.
|
4
|
+
|
5
|
+
At this point, just a few methods.
|
6
|
+
|
7
|
+
Experimenting with YARD documentation.
|
data/lib/test_values.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
class StringValues < ValuesBase
|
2
|
+
|
3
|
+
BASE_STRING = 'x'
|
4
|
+
# Return a string of the given +size+,
|
5
|
+
# built by trimming or extending the given +base_string+.
|
6
|
+
# @param size [Integer] the size of the string to be returned.
|
7
|
+
# @param base_string [String] the base string to be trimmed or extended.
|
8
|
+
# @return [String] a string of the given size.
|
9
|
+
# @raise [TypeError] if +size+ is not an +Integer+.
|
10
|
+
# @raise [TypeError] if +base_string+ is not a +String+.
|
11
|
+
# @raise [RangeError] if +size+ is negative.
|
12
|
+
def self.string_of_size(size, base_string=BASE_STRING)
|
13
|
+
self.verify_class('size', Integer, size)
|
14
|
+
self.verify_class('base_string', String, base_string)
|
15
|
+
if size < 0
|
16
|
+
message = "Parameter size must be nonnegative, not #{size}"
|
17
|
+
raise RangeError.new(message)
|
18
|
+
end
|
19
|
+
return '' if size == 0
|
20
|
+
s = base_string
|
21
|
+
while s.size < size
|
22
|
+
s = s * 2
|
23
|
+
end
|
24
|
+
return s[0..size-1]
|
25
|
+
end
|
26
|
+
|
27
|
+
# Return a hash of strings of minimum and maximum length
|
28
|
+
# for the given +range+.
|
29
|
+
# @param range [Range] specifies the minimum and maximum string lengths.
|
30
|
+
# @param base_string [String] specifies the +base_string+
|
31
|
+
# @see string_of_size string_of_size for exceptions raised.
|
32
|
+
# @return [Hash] +Symbol+/+String+ pairs
|
33
|
+
# with keys +:min_length+ and +:max_length+.
|
34
|
+
def self.strings_in_length_range(range, base_string=BASE_STRING)
|
35
|
+
self.verify_class('range', Range, range)
|
36
|
+
{
|
37
|
+
:min_length => self.string_of_size(range.first, base_string),
|
38
|
+
:max_length => self.string_of_size(range.last, base_string),
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Return a hash of strings not within minimum and maximum length
|
43
|
+
# for the given +range+.
|
44
|
+
# @param range [Range] specifies the minimum and maximum string lengths.
|
45
|
+
# @param base_string [String] specifies the +base_string+
|
46
|
+
# @see string_of_size string_of_size for exceptions raised.
|
47
|
+
# @return [Hash] +Symbol+/+String+ pairs
|
48
|
+
# with keys +:too_short+ and +:too_long+.
|
49
|
+
def self.strings_not_in_length_range(range, base_string=BASE_STRING)
|
50
|
+
self.verify_class('range', Range, range)
|
51
|
+
{
|
52
|
+
:too_short => self.string_of_size(range.first - 1, base_string),
|
53
|
+
:too_long => self.string_of_size(range.last + 1, base_string),
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/lib/test_values/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = '0.
|
1
|
+
class TestValues
|
2
|
+
VERSION = '0.2.0'
|
3
3
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_values
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- burdettelamar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,6 +70,8 @@ files:
|
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
72
|
- lib/test_values.rb
|
73
|
+
- lib/test_values/string_values.rb
|
74
|
+
- lib/test_values/values_base.rb
|
73
75
|
- lib/test_values/version.rb
|
74
76
|
- test_values.gemspec
|
75
77
|
homepage: https://github.com/BurdetteLamar/test_values
|
@@ -87,9 +89,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
89
|
version: '0'
|
88
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
91
|
requirements:
|
90
|
-
- - "
|
92
|
+
- - ">="
|
91
93
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
94
|
+
version: '0'
|
93
95
|
requirements: []
|
94
96
|
rubyforge_project:
|
95
97
|
rubygems_version: 2.4.5.2
|