dither 0.0.13-java → 0.0.14-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09eb8f9c172f2c8272ce2ecebfca696fb3f0bd96
4
- data.tar.gz: 8fe24e47535703bfcdbf0d7b89d98057f5b7f58b
3
+ metadata.gz: d5b7420519739680db03d3fe61fde5b2dbfdd232
4
+ data.tar.gz: 9040ba82bca618ecef442c9d57ee22dfc480cd44
5
5
  SHA512:
6
- metadata.gz: 264f35c17cd6cb3b438b16f203d6b1ecf080eff713311c20d84c0bb98205ebeb2a8732bd62753df961ee45c27bd95981f91cbea667ed990f109f113cc0a41cef
7
- data.tar.gz: 70ab8e5682939a65c83eb0672de26fc8adfdee41207b7093e7815f7533508219cf1beb61544674f8cc45482a337eaa7a6c8ec66504e58c94be4e8981cf1ec3b9
6
+ metadata.gz: 0190ae6f58bd9e8859936724014184f553ad56dc8873a68c72c1971d4d767b30d093e5d98d475c9bc1d6ccea76d0e887053844f22583e705f9c3067b12b8e68b
7
+ data.tar.gz: 4fd98411e58f744ac2ec6e862e7bc7cf99d30bcacbdea419dfd8a204bdd38cc0fb22b8aab42c326f0f1cfc23381cd3d5b42ce1c058dc5e96af850885ef3bbdd6
data/dither.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  if RUBY_PLATFORM =~ /java/
24
24
  s.platform = "java"
25
25
  # compile dither-java on jdk 7
26
- files << "lib/dither.jar"
26
+ files << "lib/dither-0.0.3.jar"
27
27
  end
28
28
  s.files = files
29
29
 
@@ -41,22 +41,22 @@ module Dither
41
41
  end
42
42
  end
43
43
  @constraints = nil
44
- if opts[:constraints]
45
- @constraints = []
46
- opts[:constraints].each do |a|
47
- constraint = a.map { |k, v| pair_cache[k][v] }
48
- constraint.extend(Pairs)
49
- @constraints << constraint
50
- end
51
- end
44
+ if opts[:constraints]
45
+ @constraints = []
46
+ opts[:constraints].each do |a|
47
+ constraint = a.map { |k, v| pair_cache[k][v] }
48
+ constraint.extend(Pairs)
49
+ @constraints << constraint
50
+ end
51
+ end
52
52
  @comb = []
53
53
  @t = opts[:t]
54
54
  (0...params.length).to_a.combination(t).each do |a|
55
- car, *cdr = a.map { |b| pair_cache[b] }
56
- tmp = car.product(*cdr)
57
- tmp.each { |b| b.extend(Pairs) }
55
+ car, *cdr = a.map { |b| pair_cache[b] }
56
+ tmp = car.product(*cdr)
57
+ tmp.each { |b| b.extend(Pairs) }
58
58
  tmp.reject! { |b| constraints.any? { |c| c.all? { |d| b.include?(d)} } } if constraints
59
- @comb.push(*tmp)
59
+ @comb.push(*tmp)
60
60
  end
61
61
  end
62
62
 
@@ -68,14 +68,14 @@ module Dither
68
68
 
69
69
  def filter
70
70
  return unless constraints
71
- scratch.each_with_index do |e, i|
72
- scratch[i] = nil if constraints.any? { |a| a.in_test_case?(e) }
73
- end
71
+ scratch.each_with_index do |e, i|
72
+ scratch[i] = nil if constraints.any? { |a| a.in_test_case?(e) }
73
+ end
74
74
  end
75
75
 
76
76
  def best_fit
77
- max, _ = scratch.compact
78
- .map { |a| [a, comb.count { |b| b.in_test_case?(a) }] }
77
+ max, _ = scratch.compact
78
+ .map { |a| [a, comb.count { |b| b.in_test_case?(a) }] }
79
79
  .max { |a, b| a[1] <=> b[1] }
80
80
  comb.delete_if { |a| a.in_test_case?(max) }
81
81
  max
@@ -13,6 +13,19 @@ module Dither
13
13
  raise Dither::Error.new(e.message)
14
14
  end
15
15
 
16
+ def self.ateg(params, opts = {})
17
+ opts = DEFUALT_OPTS.dup.merge(opts)
18
+ constraints = constraints_to_java(params.length, opts[:constraints])
19
+ com.github.jesg.dither.Dither.ateg(
20
+ opts[:t].to_java(:int),
21
+ opts[:seed].to_java(:Integer),
22
+ params.map(&:to_java).to_java,
23
+ constraints,
24
+ (opts[:previously_tested] || []).map(&:to_java).to_java).to_a
25
+ rescue com.github.jesg.dither.DitherError => e
26
+ raise Dither::Error.new(e.message)
27
+ end
28
+
16
29
  private
17
30
 
18
31
  def self.constraints_to_java(param_length, constraints)
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Dither
3
- VERSION = '0.0.13'
3
+ VERSION = '0.0.14'
4
4
  end
Binary file
data/lib/dither.rb CHANGED
@@ -44,7 +44,7 @@ require 'dither/ateg_pairwise'
44
44
 
45
45
  if RUBY_PLATFORM =~ /java/
46
46
  require 'java'
47
- require 'dither.jar'
47
+ require 'dither-0.0.3.jar'
48
48
 
49
49
  require 'dither/java_ext/dither'
50
50
  end
@@ -174,7 +174,7 @@ describe Dither do
174
174
  it 'can run 4-way ateg with seed' do
175
175
  params = [(0...2).to_a, (0...2).to_a, (0...2).to_a, (0..3).to_a]
176
176
  expect(Dither.ateg(params, :t => 4, :seed => 0, :constraints => [
177
- { 0 => 1, 1 => 1, 2 => 1, 3 => 1 },
178
- ], :previously_tested => [[1,1,1,2]]).length).to eq 30
177
+ { 0 => 1, 1 => 1, 2 => 1, 3 => 1 },
178
+ ], :previously_tested => [[1,1,1,2]]).length).to eq 30
179
179
  end
180
180
  end
metadata CHANGED
@@ -1,25 +1,25 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dither
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  platform: java
6
6
  authors:
7
7
  - Jason Gowan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-19 00:00:00.000000000 Z
11
+ date: 2015-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
20
  requirement: !ruby/object:Gem::Requirement
21
21
  requirements:
22
- - - ~>
22
+ - - "~>"
23
23
  - !ruby/object:Gem::Version
24
24
  version: '3.2'
25
25
  prerelease: false
@@ -28,12 +28,12 @@ dependencies:
28
28
  name: rake
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.9.2
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  requirements:
36
- - - ~>
36
+ - - "~>"
37
37
  - !ruby/object:Gem::Version
38
38
  version: 0.9.2
39
39
  prerelease: false
@@ -42,12 +42,12 @@ dependencies:
42
42
  name: coveralls
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  requirements:
50
- - - '>='
50
+ - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  prerelease: false
@@ -59,15 +59,16 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
63
- - .ruby-version
64
- - .travis.yml
62
+ - ".gitignore"
63
+ - ".ruby-version"
64
+ - ".travis.yml"
65
65
  - Gemfile
66
66
  - Gemfile.lock
67
67
  - LICENSE
68
68
  - README.md
69
69
  - Rakefile
70
70
  - dither.gemspec
71
+ - lib/dither-0.0.3.jar
71
72
  - lib/dither.rb
72
73
  - lib/dither/ateg.rb
73
74
  - lib/dither/ateg_pairwise.rb
@@ -83,7 +84,6 @@ files:
83
84
  - spec/dither/chinese_postman_problem_spec.rb
84
85
  - spec/dither/dither_spec.rb
85
86
  - spec/spec_helper.rb
86
- - lib/dither.jar
87
87
  homepage: https://github.com/jesg/dither
88
88
  licenses:
89
89
  - MIT
@@ -94,17 +94,17 @@ require_paths:
94
94
  - lib
95
95
  required_ruby_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - '>='
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project: dither
107
- rubygems_version: 2.1.9
107
+ rubygems_version: 2.4.8
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Collection of test generation strategies
data/lib/dither.jar DELETED
Binary file