dither 0.2.0.rc3 → 0.2.0.rc4

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: 378d5b7748d2b3993ef979f2e0ecc1e7f2f1866a
4
- data.tar.gz: 6c3159e8073600044df182be4bd6dc201c9f45a1
3
+ metadata.gz: c7e321420a2ba706f3f24e8e3d2191da27fce614
4
+ data.tar.gz: 094b5152e0d320355a6e465210ecd9c267f0c6f8
5
5
  SHA512:
6
- metadata.gz: 8ac2ff8f4c0110f4a3b5d81e361bb52c568eccb7bc32cb28a7eed55f0f36ae7f7b2f1689804c4ed5a4c2cddec162c3946fa8bc995980e1f9968b606368e132b3
7
- data.tar.gz: 6c4cc50f3da60255d6f1065506a8d1b2a2d0b601e96af11d3f664ee2374c08bd06c2bbc40006c2403308d021dd84d96d15f8cb83a11be9e51d4663c52ef88dab
6
+ metadata.gz: 06c79a55ca5dcfbef0a287120bebf8aa6b558f079a6ba08551c2786abd5b15bf7b95059ec231a71dcbca736c514a6a5a29e0ce24d57c94c9210ebe280ffbe7b1
7
+ data.tar.gz: 456b3f07542dbb81a580910b7468ff2f39cc48b422e0704defcf8473c84cf7edf0676920b79b54aab72e176100afee574a2f55ba9c335e216f85477d6ebd8d70
@@ -8,13 +8,14 @@
8
8
  */
9
9
 
10
10
  #include "simple_constraint_handler.h"
11
+ #include <iostream>
11
12
 
12
13
  namespace dither {
13
14
 
14
15
  SimpleConstraintHandler::SimpleConstraintHandler(std::vector<dval>& ranges, std::vector<std::vector<dval>>& pconstraints) : params(ranges) {
15
16
  for(auto it = pconstraints.cbegin(); it != pconstraints.cend(); ++it) {
16
17
  std::vector<std::pair<std::size_t, dval>> constraint;
17
- int i = 0;
18
+ std::size_t i = 0;
18
19
  for(auto iit = (*it).cbegin(); iit != (*it).cend(); ++iit, i++) {
19
20
  if((*iit) != -1) {
20
21
  constraint.push_back(std::make_pair(i, *iit));
@@ -86,32 +87,30 @@ namespace dither {
86
87
  if(indexes.size() == 0) {
87
88
  return true;
88
89
  }
89
- std::vector<dval> bound_values(indexes.size(), 0);
90
+ std::vector<dval> bound_values(indexes.size(), -1);
90
91
  i = 0;
91
92
 
92
- LOOP:{
93
- do {
94
- test_case[indexes[i]] = bound_values[i];
95
- if(violate_constraints(test_case)) {
96
- // try to bump a bound value... return false if no valid value
97
- const std::size_t upper_bound = i + 1;
98
- for(std::size_t j = 0; j < upper_bound; j++) {
99
- auto bump_value = bound_values[i] + 1;
100
- if(bump_value < params[indexes[i]]) {
101
- bound_values[i] = bump_value;
102
- goto LOOP;
103
- }
104
-
105
- // unwind
106
- bound_values[i] = 0;
107
- test_case[indexes[i]] = -1;
108
- i--;
109
- }
93
+ LOOP:while(i < indexes.size()) {
110
94
 
111
- return false;
95
+ const dval max = params[indexes[i]];
96
+ for(dval value = bound_values[i] + 1; value <= max; value++) {
97
+ test_case[indexes[i]] = value;
98
+ if(violate_constraints(test_case)) {
99
+ continue;
112
100
  }
101
+ bound_values[i] = value;
113
102
  i++;
114
- }while(i < indexes.size());
103
+ goto LOOP;
104
+ }
105
+
106
+ if(i == 0) {
107
+ return false;
108
+ }
109
+
110
+ // unwind
111
+ bound_values[i] = -1;
112
+ test_case[indexes[i]] = -1;
113
+ i--;
115
114
  }
116
115
 
117
116
  return true;
data/lib/dither/api.rb CHANGED
@@ -5,7 +5,8 @@ require 'ffi'
5
5
  module Dither
6
6
  module API
7
7
  extend FFI::Library
8
- ffi_lib %w[lib/dither.so lib/dither.dll]
8
+ LIB_DIR = File.expand_path('../..', __FILE__)
9
+ ffi_lib %W[#{LIB_DIR}/dither.so #{LIB_DIR}/dither.dll]
9
10
 
10
11
  attach_function :dither_ipog_new, [:int], :pointer
11
12
  attach_function :dither_ipog_add_parameter_int, [:pointer, :int, :pointer, :int], :void
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Dither
3
- VERSION = '0.2.0.rc3'
3
+ VERSION = '0.2.0.rc4'
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.0.rc3
4
+ version: 0.2.0.rc4
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-08 00:00:00.000000000 Z
11
+ date: 2015-12-10 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: 1.3.1
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