dither 0.2.1 → 0.2.2

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: b23198b7faddebcd97e1656ffa56e8f7dbb067f7
4
- data.tar.gz: bb83f1fafe1e7366f090b750af571d1bd61aeb95
3
+ metadata.gz: 8b2f3f8fa861ae290b01ece8edf0150480d7b3cf
4
+ data.tar.gz: 3c00e98cf8b3b8a80b4327f2418068d07e871db5
5
5
  SHA512:
6
- metadata.gz: d199030a4862dfdf5d18744da482bbcef95d29b8a43d85f3285f1e8c90d2c655b34d958ed3c7eae087fc42b9a30ce83bc98d0cd6e9629faab25f5d01c049f643
7
- data.tar.gz: 5e5510739b5ac632cf92e8da6cd7ba7e4ae60362a39047c9ea5f2c29f6db4dde73449de47cfc28708c0d366e4af1a2dffadb9ba879d891fe4d68c52e41f1a273
6
+ metadata.gz: 62e73bc1bf276f26aab2d0115fb6125fb01871695a57823078401a3475a102bffbeb588d3c48552f5094f4a1ec339112053c657329b27f9bac068d4b04400644
7
+ data.tar.gz: 0154292ff25b831fc39acd29388efb5e0520e7434db8282942ab5f7e1b8bdd00db4215b3a71e2ee83fd1f2f2f07a38b75139b830b745e6af55efc0cc3c4a2a92
data/ext/dither/ipog.cc CHANGED
@@ -13,6 +13,7 @@
13
13
  #include <utility>
14
14
  #include <tuple>
15
15
  #include <limits.h>
16
+ #include <cstddef>
16
17
 
17
18
  namespace dither {
18
19
 
@@ -107,37 +108,41 @@ void Ipog::run() {
107
108
  const std::vector<param> &test_case = *pairs;
108
109
  bool case_covered = constraint_handler->violate_constraints(test_case);
109
110
 
110
- if (!case_covered) {
111
- bool is_merged = false;
112
- auto prev = unbound_.before_begin();
113
- auto next = unbound_.begin();
114
- auto end = unbound_.end();
115
- while (next != end) {
116
- const int merge_result = merge(k, *next, test_case);
117
- if (merge_result == 0) {
118
- bound_.push_front(*next);
119
- unbound_.erase_after(prev);
120
- is_merged = true;
121
- break;
122
- } else if (merge_result == 1) {
123
- is_merged = true;
124
- break;
125
- }
126
- ++prev;
127
- ++next;
128
- }
129
-
130
- if (!is_merged) {
131
- dtest_case unbound_test_case(param_cache_.size(), -1);
132
- for (auto it = test_case.cbegin(); it != test_case.cend(); ++it) {
133
- unbound_test_case[(*it).first] = (*it).second;
134
- }
135
- if (!constraint_handler->violate_constraints(unbound_test_case)) {
136
- unbound_.push_front(unbound_test_case);
137
- }
138
- }
139
- }
111
+ if(!case_covered) {
112
+ for (auto it = unbound_.cbegin(); it != unbound_.cend(); ++it) {
113
+ if(is_covered(*it, test_case)) {
114
+ case_covered = true;
115
+ break;
116
+ }
117
+ }
118
+ }
119
+
120
+ if (!case_covered) {
121
+ bool is_merged = false;
122
+
123
+ for(auto next = unbound_.begin(); next != unbound_.end(); ++next) {
124
+ const int merge_result = merge(k, *next, test_case);
125
+
126
+ if (merge_result > 0) {
127
+ dtest_case tmp = *next;
128
+ for (auto it = test_case.cbegin(); it != test_case.cend(); ++it) {
129
+ tmp[(*it).first] = (*it).second;
130
+ }
131
+ is_merged = true;
132
+ break;
133
+ }
134
+ }
140
135
 
136
+ if (!is_merged) {
137
+ dtest_case unbound_test_case(param_cache_.size(), -1);
138
+ for (auto it = test_case.cbegin(); it != test_case.cend(); ++it) {
139
+ unbound_test_case[(*it).first] = (*it).second;
140
+ }
141
+ if (!constraint_handler->violate_constraints(unbound_test_case)) {
142
+ unbound_.push_front(unbound_test_case);
143
+ }
144
+ }
145
+ }
141
146
  }
142
147
  }
143
148
  ground_solutions();
@@ -163,12 +168,8 @@ inline const int Ipog::merge(const int k, dtest_case &test_case,
163
168
  return -1;
164
169
  }
165
170
 
166
- for (auto it = pairs.cbegin(); it != pairs.cend(); ++it) {
167
- test_case[(*it).first] = (*it).second;
168
- }
169
-
170
- for (auto i = 0; i < k; i++) {
171
- if (test_case[i] == -1) {
171
+ for (auto i = 0; i <= k; i++) {
172
+ if (merge_scratch_[i] == -1) {
172
173
  return 1;
173
174
  }
174
175
  }
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Dither
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
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.1
4
+ version: 0.2.2
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-12 00:00:00.000000000 Z
11
+ date: 2015-12-14 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.4.5.1
143
+ rubygems_version: 2.2.0
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Collection of test generation strategies