regtest 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog +4 -0
  3. data/Rakefile +1 -1
  4. data/lib/regtest.rb +27 -2
  5. metadata +6 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f285779cdef88936499612293c73cd6195f96296
4
- data.tar.gz: ec1c2d6e64f81fb7da3b0b3f45e13bc67a08c6d5
3
+ metadata.gz: 343e3f6247f912e2c9f8e2b3262caa2c2b8beb72
4
+ data.tar.gz: 2c1678dc4ce5ddce32eae6978697052247c84d43
5
5
  SHA512:
6
- metadata.gz: 366a6e473d26cb35233b5fe23c4460724dbaef391226413dc49f023d7b55ad05d745d7b99401971444cdf60382c0aa9b1c2399caed4ec388700b963d2bbed5d8
7
- data.tar.gz: d8f27f2758029cfbcd0388090e39ecafe5ed336810c9fc0f8ef317cd4f3172bdbc276e0c0e716505787d054e466dcb9796cb736ed3f8b54acb0721c579264b38
6
+ metadata.gz: a8a7f7b43d635e98a95bff01adad429a4b3b52752dfbdc9289fd8c0dcb4a1e400c8b849fc024cad07119eec7ec477df6c463454c1c61ff0c4a17cd3dae536ce6
7
+ data.tar.gz: f9c04ec27a23e8bf1f6ccc579e2b95004dd8ec9975ab67948c8d02ea4730ba813fceeabecf59e371ed5e936d8086b769269e7579412243a8358101f2449c08d6
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ 0.5.0
2
+ New method Regtest.combinations to build all combinations of a
3
+ Hash-like object with arrays as values.
4
+
1
5
  0.4.0
2
6
  Improve rake task:
3
7
  - New constant REGTEST_FILES to define the Ruby files to work on.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'regtest/task'
6
6
 
7
7
  Rim.setup do |p|
8
8
  p.name = 'regtest'
9
- p.version = '0.4.0'
9
+ p.version = '0.5.0'
10
10
  p.authors = 'Jan Friedrich'
11
11
  p.email = 'janfri26@gmail.com'
12
12
  p.summary = 'Regression testing in Ruby.'
@@ -1,10 +1,11 @@
1
1
  #
2
2
  # Regtest - Simple Regression Testing For Ruby Projects
3
3
  #
4
- # Copyright 2014 by Jan Friedrich (janfri26@gmail.com)
4
+ # Copyright 2014, 2015 by Jan Friedrich (janfri26@gmail.com)
5
5
  # License: Regtest is licensed under the same terms as Ruby itself.
6
6
  #
7
7
 
8
+ require 'ostruct'
8
9
  require 'yaml'
9
10
 
10
11
  module Regtest
@@ -33,11 +34,35 @@ module Regtest
33
34
  print '.'; $stdout.flush
34
35
  end
35
36
 
37
+ # Build all combinations of a Hash-like object with arrays as values.
38
+ # Return value is an array of OpenStruct instances.
39
+ #
40
+ # Example:
41
+ # require 'ostruct'
42
+ # o = OpenStruct.new
43
+ # o.a = [1,2,3]
44
+ # o.b = [:x, :y]
45
+ # Regtest.combinations(o).map(&:to_h) # => [{:a=>1, :b=>:x}, {:a=>1, :b=>:y}, {:a=>2, :b=>:x}, {:a=>2, :b=>:y}, {:a=>3, :b=>:x}, {:a=>3, :b=>:y}]
46
+ #
47
+ def combinations hashy
48
+ h = hashy.to_h
49
+ a = h[h.keys[0]].product(*h.values[1..-1])
50
+ res = []
51
+ a.each do |e|
52
+ o = OpenStruct.new
53
+ h.keys.zip(e) do |k, v|
54
+ o[k] = v
55
+ end
56
+ res << o
57
+ end
58
+ res
59
+ end
60
+
36
61
  class << self
37
62
  attr_accessor :count, :results, :start
38
63
  end
39
64
 
40
- module_function :sample
65
+ module_function :sample, :combinations
41
66
 
42
67
  end
43
68
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regtest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Friedrich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rim
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.2'
19
+ version: '2.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.2'
26
+ version: '2.6'
27
27
  description: Regression testing in Ruby.
28
28
  email: janfri26@gmail.com
29
29
  executables: []
@@ -55,8 +55,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
55
  version: '0'
56
56
  requirements: []
57
57
  rubyforge_project:
58
- rubygems_version: 2.2.2
58
+ rubygems_version: 2.5.0
59
59
  signing_key:
60
60
  specification_version: 4
61
61
  summary: Regression testing in Ruby.
62
62
  test_files: []
63
+ has_rdoc: