dither 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/ext/dither/ipog.cc +48 -30
- data/lib/dither/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01b92d7c2a5378b386ca65f4d71df1120c3782cf
|
4
|
+
data.tar.gz: 6c44ca627b200e9188f4aad2dab3575cf6a4742b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5318e78b9eb0b81b49441b7c1a3784bca2c73be27a569170b5e9e7889258af4b846806f39b10a25cb21828b5b0dc5ff219afc576739a8f6c2b85cf3d721087e5
|
7
|
+
data.tar.gz: 1aa0885ecffc700a43937bef1f79fccb2c5985816825e0d07390c0b2b65b5a1f4d97166b40f14ac905a00b50f2767ad03bca8a6af41276110a1e740b5e84d942
|
data/README.md
CHANGED
data/ext/dither/ipog.cc
CHANGED
@@ -122,19 +122,28 @@ void Ipog::run() {
|
|
122
122
|
|
123
123
|
if (!case_covered) {
|
124
124
|
bool is_merged = false;
|
125
|
-
|
126
|
-
|
125
|
+
auto prev = unbound_.before_begin();
|
126
|
+
auto next = unbound_.begin();
|
127
|
+
auto end = unbound_.end();
|
128
|
+
while (next != end) {
|
127
129
|
const int merge_result = merge(k, *next, test_case);
|
128
130
|
|
129
|
-
if (merge_result
|
130
|
-
dtest_case tmp = *next;
|
131
|
+
if (merge_result >= 0) {
|
131
132
|
for (std::size_t i = 0; i < t_; i++) {
|
132
133
|
const param *it = test_case[i];
|
133
|
-
|
134
|
+
(*next)[it->first] = it->second;
|
134
135
|
}
|
135
136
|
is_merged = true;
|
137
|
+
}
|
138
|
+
if (merge_result == 0) {
|
139
|
+
bound_.push_front(*next);
|
140
|
+
unbound_.erase_after(prev);
|
141
|
+
break;
|
142
|
+
} else if (merge_result == 1) {
|
136
143
|
break;
|
137
144
|
}
|
145
|
+
++prev;
|
146
|
+
++next;
|
138
147
|
}
|
139
148
|
|
140
149
|
if (!is_merged) {
|
@@ -150,6 +159,7 @@ void Ipog::run() {
|
|
150
159
|
}
|
151
160
|
}
|
152
161
|
}
|
162
|
+
|
153
163
|
ground_solutions();
|
154
164
|
}
|
155
165
|
|
@@ -206,32 +216,39 @@ inline bool Ipog::is_covered(const dtest_case &test_case,
|
|
206
216
|
inline const int Ipog::maximize_coverage(const int k, dtest_case &test_case,
|
207
217
|
std::forward_list<param **> &pi) {
|
208
218
|
const std::vector<param> ¶m_range = param_cache_[k];
|
209
|
-
|
210
|
-
|
211
|
-
std::
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
test_case
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
tmp_covered.push_front(prev);
|
224
|
-
count++;
|
225
|
-
}
|
226
|
-
}
|
219
|
+
std::vector<std::forward_list<std::forward_list<param **>::iterator>> covered(
|
220
|
+
param_range.size());
|
221
|
+
std::vector<int> counts(param_range.size());
|
222
|
+
const std::size_t index = param_range[0].first;
|
223
|
+
std::vector<std::size_t> valid_indexes;
|
224
|
+
valid_indexes.reserve(counts.size());
|
225
|
+
for (std::size_t i = 0; i < counts.size(); i++) {
|
226
|
+
test_case[index] = param_range[i].second;
|
227
|
+
if (constraint_handler->violate_constraints(test_case)) {
|
228
|
+
counts[i] = -1;
|
229
|
+
} else {
|
230
|
+
valid_indexes.push_back(i);
|
231
|
+
}
|
232
|
+
}
|
227
233
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
234
|
+
auto prev = pi.before_begin();
|
235
|
+
for (auto params = pi.begin(); params != pi.end(); ++params, ++prev) {
|
236
|
+
for (auto i : valid_indexes) {
|
237
|
+
test_case[index] = param_range[i].second;
|
238
|
+
if (is_covered(test_case, *params)) {
|
239
|
+
covered[i].push_front(prev);
|
240
|
+
++counts[i];
|
232
241
|
}
|
233
242
|
}
|
234
|
-
|
243
|
+
}
|
244
|
+
|
245
|
+
int current_max = -1;
|
246
|
+
std::size_t max_index = 0;
|
247
|
+
for (auto i : valid_indexes) {
|
248
|
+
if (current_max < counts[i]) {
|
249
|
+
current_max = counts[i];
|
250
|
+
max_index = i;
|
251
|
+
}
|
235
252
|
}
|
236
253
|
|
237
254
|
if (current_max == -1) {
|
@@ -239,11 +256,12 @@ inline const int Ipog::maximize_coverage(const int k, dtest_case &test_case,
|
|
239
256
|
}
|
240
257
|
|
241
258
|
/* remove covered */
|
242
|
-
for (auto it = covered.begin(); it != covered.end();
|
259
|
+
for (auto it = covered[max_index].begin(); it != covered[max_index].end();
|
260
|
+
++it) {
|
243
261
|
pi.erase_after(*it);
|
244
262
|
}
|
245
263
|
|
246
|
-
test_case[
|
264
|
+
test_case[index] = param_range[max_index].second;
|
247
265
|
return current_max;
|
248
266
|
}
|
249
267
|
|
data/lib/dither/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Gowan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
152
|
rubyforge_project: dither
|
153
|
-
rubygems_version: 2.
|
153
|
+
rubygems_version: 2.2.0
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Collection of test generation strategies
|