condition 0.0.27 → 0.0.28

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: 050b71f7bdf86ef89f20b29f0224d357ffacb789
4
- data.tar.gz: 9375d2c0dc2a57025ef3591ba9a9139135038832
3
+ metadata.gz: 5a71ca9f6eeadb13b4693a1225abb81daf9aac06
4
+ data.tar.gz: 5c5bc5b440e4df1144986b9ed14a86a12c66e9fd
5
5
  SHA512:
6
- metadata.gz: 624c722b84ef2d2c6c145d3b6fb3474f650d43fb340b0d6ad5619a39c485fb642b3d578e1903764f78b1e1ac942fcf5ad3e7be8cefa0f1c583e194951b7e7617
7
- data.tar.gz: 9902d2e5e09f98854e2c99eb45ee7d47bbbd5744461cd1edb10a66ff2f5f11b2c21f61bb75c983031e5dc82d277ac1c3cf818961c83a5708879d948831d70641
6
+ metadata.gz: f034d5dae5c0b284d232fb5d28c54e8b5e5a192401f36f796f96570c8bda4db2390e24438cf5930803f7d9324292b4557a7c1715440bd75c95f3ac7bace0e591
7
+ data.tar.gz: c8b61d6e3da820a82aa467607ba15f8f78fc50126d0c5e5b0e2b4df07b5d00a51ca30336dc8d4dbb889db6011bbbdb555ce72d633ed7fe24ed24537792eba0fc
data/README.md CHANGED
@@ -30,6 +30,9 @@ TODO: Write usage instructions here
30
30
 
31
31
  ## Changes
32
32
 
33
+ 2014-02-19 0.0.28
34
+ modify bug order check in no options
35
+
33
36
  2014-01-30 0.0.27
34
37
  check param.check name not found
35
38
  view expected <> real
@@ -52,8 +52,10 @@ module Condition
52
52
  item = item(name)
53
53
  raise "#{name} not found in param" if item.nil?
54
54
  item.clear_used_values
55
+ index = 0
55
56
  data.each do |line|
56
- item.check_line(line)
57
+ item.check_line(line, index)
58
+ index += 1
57
59
  end
58
60
  raise "#{item.name} not exists row" if item.is_remain_value
59
61
  end
@@ -70,8 +72,10 @@ module Condition
70
72
  @item_map.each_value do |item|
71
73
  item.clear_used_values
72
74
  list = storage.all(item)
75
+ index = 0
73
76
  list.each do |line|
74
- item.check_line(line)
77
+ item.check_line(line, index)
78
+ index += 1
75
79
  end
76
80
  raise "#{item.name} not exists row" if item.is_remain_value
77
81
  end
@@ -158,8 +158,7 @@ module Condition
158
158
  end
159
159
  end
160
160
 
161
- def check_value(real, value)
162
- targetFlag = true
161
+ def check_value(real, value, targetFlag)
163
162
  matchFlag = true
164
163
  @unmatch_info = []
165
164
  value.each_pair do |k, v|
@@ -179,9 +178,12 @@ module Condition
179
178
  end
180
179
  end
181
180
 
182
- def check_line(real)
181
+ def check_line(real, index)
182
+ value_index = 0
183
183
  @values.each do |value|
184
- return if check_value(real, value)
184
+ targetFlag = @options.empty? ? value_index == index : true
185
+ return if check_value(real, value, targetFlag)
186
+ value_index += 1
185
187
  end
186
188
  raise "#{@name} not found " + real.to_s
187
189
  end
@@ -1,5 +1,5 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module Condition
4
- VERSION = "0.0.27"
4
+ VERSION = "0.0.28"
5
5
  end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
  describe Condition do
3
3
  before(:all) do
4
- DB << "DROP TABLE IF EXISTS t_user"
5
- DB << "DROP TABLE IF EXISTS t_test"
4
+ DB << "DROP TABLE IF EXISTS t_user CASCADE"
5
+ DB << "DROP TABLE IF EXISTS t_test CASCADE"
6
6
  DB << "CREATE TABLE t_user(user_id BIGINT, user_name TEXT, login_ts TIMESTAMPTZ NOT NULL)"
7
7
  DB << "CREATE TABLE t_test(id BIGINT, name TEXT, flag BOOLEAN, ts TIMESTAMPTZ, iary BIGINT[], tary TEXT[], test_name TEXT NOT NULL)"
8
8
  DB << "CREATE SCHEMA IF NOT EXISTS history"
9
- DB << "DROP TABLE IF EXISTS history.t_user"
9
+ DB << "DROP TABLE IF EXISTS history.t_user CASCADE"
10
10
  DB << "CREATE TABLE history.t_user(user_id BIGINT, user_name TEXT, login_ts TIMESTAMPTZ NOT NULL)"
11
11
 
12
12
  converter = Condition::Reader::ConvertSheet.new(REDIS)
@@ -170,4 +170,30 @@ describe Condition do
170
170
  expect { param.check('notexistsname', [{}]) }.to raise_error("notexistsname not found in param")
171
171
  end
172
172
 
173
+ it 'many options' do
174
+ param = Condition::Param.new(FILES + '/t_user.ods', 2)
175
+ param.check('output_options', [
176
+ {val1: "2", val2: "2", val3: "z"},
177
+ {val1: "1", val2: "1", val3: "w"},
178
+ {val1: "1", val2: "2", val3: "x"},
179
+ {val1: "2", val2: "1", val3: "y"},
180
+ ])
181
+ param.check('output_options2', [
182
+ {val1: "1", val2: "2", val3: "z"},
183
+ {val1: "1", val2: "2", val3: "w"},
184
+ {val1: "1", val2: "2", val3: "x"},
185
+ {val1: "1", val2: "2", val3: "y"},
186
+ ])
187
+ end
188
+
189
+ it 'output order' do
190
+ param = Condition::Param.new(FILES + '/t_user.ods', 2)
191
+ param.check('output_order', [
192
+ {val1: "1", val2: "4"},
193
+ {val1: "1", val2: "3"},
194
+ {val1: "1", val2: "2"},
195
+ {val1: "1", val2: "1"},
196
+ ])
197
+ end
198
+
173
199
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: condition
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - aoyagikouhei
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  version: '0'
199
199
  requirements: []
200
200
  rubyforge_project:
201
- rubygems_version: 2.2.0
201
+ rubygems_version: 2.2.2
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: Condition Test