dither 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6eee85218675a1f34727510d59deb7f96552bbe
4
- data.tar.gz: 4eaf5cd8e4b56480da4ef311f1f9091e927e946b
3
+ metadata.gz: b23198b7faddebcd97e1656ffa56e8f7dbb067f7
4
+ data.tar.gz: bb83f1fafe1e7366f090b750af571d1bd61aeb95
5
5
  SHA512:
6
- metadata.gz: 3dcf14ef093b4f59b2fc86aa0dd65898a7bc33bc2f50a3d2c580918050948cc100841a1eadf1c798d9e1332934751c86136c22cc0ef68d71d45345ecd36b078f
7
- data.tar.gz: 33b345fb60ba597981aecd6f8eb8be71549de09de9dc0f078cb512d2dbe7f58cb75c895c8cfdee02e74cca74ac1622295b44ad448c382847853977567adf177b
6
+ metadata.gz: d199030a4862dfdf5d18744da482bbcef95d29b8a43d85f3285f1e8c90d2c655b34d958ed3c7eae087fc42b9a30ce83bc98d0cd6e9629faab25f5d01c049f643
7
+ data.tar.gz: 5e5510739b5ac632cf92e8da6cd7ba7e4ae60362a39047c9ea5f2c29f6db4dde73449de47cfc28708c0d366e4af1a2dffadb9ba879d891fe4d68c52e41f1a273
data/dither.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  if RUBY_PLATFORM =~ /java/
25
25
  s.platform = "java"
26
26
  # compile dither-java on jdk 8
27
- files << "lib/dither-0.1.4.jar"
27
+ files << "lib/dither-0.1.5.jar"
28
28
  files << "lib/choco-solver-3.3.1-with-dependencies.jar"
29
29
  else
30
30
  s.add_dependency "ffi", "~> 1.0"
@@ -122,6 +122,75 @@ inline void product(
122
122
  rvi.pop_back(); // clean ME off for next round
123
123
  }
124
124
  }
125
+
126
+ inline void product3(
127
+ std::forward_list<dtest_case>& results,
128
+ std::vector<dtest_case>::const_iterator begin,
129
+ std::vector<dtest_case>::const_iterator end) {
130
+ dtest_case ranges;
131
+ for(auto it = begin; it != end; ++it) {
132
+ const dval tmp = (*it).size() - 1;
133
+ ranges.push_back(tmp);
134
+ }
135
+
136
+ dtest_case scratch(ranges.size(), 0);
137
+
138
+ const std::size_t max = ranges.size() - 1;
139
+ for(std::size_t i = max;;) {
140
+
141
+ if(i == max) {
142
+ for(dval val = 0; val <= ranges[i]; val++) {
143
+ results.push_front(scratch);
144
+ scratch[i]++;
145
+ }
146
+ scratch[i] = 0;
147
+ i--;
148
+ } else if(i == 0 && scratch[i] >= ranges[i]) {
149
+ return;
150
+ } else if(scratch[i] < ranges[i]) {
151
+ scratch[i]++;
152
+ i++;
153
+ } else {
154
+ scratch[i] = -1;
155
+ i--;
156
+ }
157
+ }
158
+ }
159
+
160
+ inline void product4(
161
+ std::forward_list<std::vector<param>>& results,
162
+ std::vector<std::vector<param>>& param_matrix) {
163
+ std::vector<int> ranges;
164
+ std::vector<param> scratch;
165
+ for(auto params : param_matrix) {
166
+ ranges.push_back(params.size() - 1);
167
+ scratch.push_back(params[0]);
168
+ }
169
+ std::vector<int> indexes(scratch.size(), 0);
170
+
171
+ const std::size_t max = ranges.size() - 1;
172
+ for(std::size_t i = max;;) {
173
+
174
+ if(i == max) {
175
+ for(std::size_t val = 0; val <= ranges[i]; val++) {
176
+ scratch[i] = param_matrix[i][indexes[i]];
177
+ results.push_front(scratch);
178
+ indexes[i]++;
179
+ }
180
+ indexes[i] = 0;
181
+ i--;
182
+ } else if(i == 0 && indexes[i] >= ranges[i]) {
183
+ return;
184
+ } else if(indexes[i] < ranges[i]) {
185
+ indexes[i]++;
186
+ scratch[i] = param_matrix[i][indexes[i]];
187
+ i++;
188
+ } else {
189
+ indexes[i] = -1;
190
+ i--;
191
+ }
192
+ }
193
+ }
125
194
  }
126
195
 
127
196
  #endif
data/ext/dither/ipog.cc CHANGED
@@ -31,10 +31,10 @@ Ipog::Ipog(const unsigned int t) {
31
31
  }
32
32
 
33
33
  void Ipog::init_bound() {
34
- using dither::product;
34
+ using dither::product3;
35
35
  dtest_case tmp;
36
36
 
37
- product(bound_, tmp, input_params_.begin(), input_params_.begin() + t_);
37
+ product3(bound_, input_params_.begin(), input_params_.begin() + t_);
38
38
  auto size = param_cache_.size();
39
39
  for (auto it = bound_.begin(); it != bound_.end(); ++it) {
40
40
  (*it).resize(size, -1);
@@ -77,9 +77,7 @@ std::forward_list<std::vector<param>> Ipog::cover(const int k) {
77
77
 
78
78
  std::forward_list<std::vector<param>> coverage;
79
79
  for (auto it = product_input.begin(); it != product_input.end(); ++it) {
80
- std::vector<param> tmp;
81
- std::vector<std::vector<param>> x = *it;
82
- product2(coverage, tmp, (*it).cbegin(), (*it).cend());
80
+ product4(coverage, *it);
83
81
  }
84
82
  coverage.remove_if([this](std::vector<param>& a) { return has_previously_tested(a); });
85
83
  return coverage;
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Dither
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
data/lib/dither.rb CHANGED
@@ -97,7 +97,7 @@ require 'dither/graph'
97
97
  if RUBY_PLATFORM =~ /java/
98
98
  require 'java'
99
99
  require 'choco-solver-3.3.1-with-dependencies.jar'
100
- require 'dither-0.1.4.jar'
100
+ require 'dither-0.1.5.jar'
101
101
 
102
102
  require 'dither/java_ext/dither'
103
103
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dither
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Gowan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2015-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  version: '0'
141
141
  requirements: []
142
142
  rubyforge_project: dither
143
- rubygems_version: 2.2.0
143
+ rubygems_version: 2.4.5.1
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Collection of test generation strategies