testdata 1.1.4 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: aa0d7a1cdf51ffa92c4a9bba5fc50034e39886f6
4
- data.tar.gz: 662ea0551714417be64ad5237a3fd7f3a1257396
2
+ SHA256:
3
+ metadata.gz: 32849b0ae198aae1f9d452d43546af0b38a536a1020244a1c665e57849f2a737
4
+ data.tar.gz: d36e7b2b424dba8d996e340ec339efc5d2994ce50d19b5b2597d2c257617a7c4
5
5
  SHA512:
6
- metadata.gz: 89b31c101e4426854bf6435d70156c81d400d8bf3afafc42dcbe19d79ed5788f57255583b9ca2b505d01282941e4b93e8577dbc1e17bab3d62c70912ccc698db
7
- data.tar.gz: 80a398b1075d8a74b3b70d9740cf6c0b26e0a808a255f998402a9364db39cc4befec706a02653625ebd7cce6f7118fc7c3127349bef89a8dcade199115f7542e
6
+ metadata.gz: 0afd9e441d73dc0c4a46e46d85a19eb9e48c41d9660a20c0526ea9526c510d86657542bd2949aa0fa499ef73706935127e67108ac72c0f13063d0972fe1e0b78
7
+ data.tar.gz: eae8ad80bd813f4c18b61062ac7c406a32f5f3fd0258ebd6cc1f6cdb4f7f126032cb55e01f602333a7602ee1aab74ba14c29b37f7839d9af4cd40393bc3ac5fb
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -4,8 +4,9 @@
4
4
 
5
5
  require 'app-routes'
6
6
  require 'testdata_text'
7
- require 'diffy'
7
+ require 'diffyc32'
8
8
  require 'polyrex'
9
+ require 'yaml'
9
10
 
10
11
 
11
12
  class TestdataException < Exception
@@ -14,6 +15,7 @@ end
14
15
  module Testdata
15
16
 
16
17
  class Base
18
+ using ColouredText
17
19
 
18
20
  include AppRoutes
19
21
 
@@ -54,6 +56,15 @@ module Testdata
54
56
 
55
57
  def run(raw_x=nil, debug2=nil)
56
58
 
59
+ # verify the document has unique path numbers
60
+
61
+ a = @doc.root.xpath('records/test/summary/path/text()')
62
+ duplicates = a.select{ |e| a.count(e) > 1 }.uniq
63
+
64
+ if duplicates.any? then
65
+ raise 'Duplicate path found. Path: ' + duplicates.inspect
66
+ end
67
+
57
68
  @debug2 = debug2 ? true : false
58
69
  @success = []
59
70
 
@@ -63,7 +74,7 @@ module Testdata
63
74
  else
64
75
  raw_x
65
76
  end
66
-
77
+
67
78
  procs = {NilClass: :test_all, Range: :test_range, String: :test_id,
68
79
  Integer: :test_id, Fixnum: :test_id}
69
80
 
@@ -74,28 +85,19 @@ module Testdata
74
85
  private
75
86
 
76
87
  def testdata_values(id)
77
- #puts 'testdata_values: id ' + id.inspect
78
- #exit
88
+
79
89
  node = @doc.root.element "records/test[summary/path='#{id}']"
80
- #puts 'node: ' + node.xml.inspect
81
- #exit
82
90
  raise TestdataException, "Path error: node title not found" unless node
83
91
 
84
92
  path_no = node.text('summary/path')
85
- #puts 'path_no : ' + path_no.inspect
93
+
86
94
  input_summary = node.element 'records/input/summary'
87
95
  input_summary.delete 'schema | format_mask | recordx_type'
88
- #puts 'input_summary ' + input_summary.xml.inspect
89
96
 
90
- #puts 'node : ' + node.xml.inspect
91
97
  input_nodes = input_summary.xpath('*') #[1..-1]
92
-
93
- #puts 'input:nodes : ' + input_nodes.inspect
94
- input_values = input_nodes.map{|x| x.texts.join.strip} + []
95
- #puts 'input_values : ' + input_values.inspect
96
-
98
+ input_values = input_nodes.map{|x| x.texts.map(&:unescape).join.strip}
97
99
  input_names = input_nodes.map(&:name)
98
- #puts 'input_names : ' + input_names.inspect
100
+
99
101
  raise TestdataException, 'inputs not found' if input_values.empty? \
100
102
  or input_names.empty?
101
103
 
@@ -117,12 +119,25 @@ module Testdata
117
119
  x ||=(0..-1)
118
120
 
119
121
  break_on_fail = @doc.root.element('summary/break_on_fail/text()') == 'true'
122
+
123
+ test_id = nil
120
124
 
121
- @doc.root.xpath("records/test/summary/path/text()")[x].each do |id|
125
+ begin
126
+
127
+ @doc.root.xpath("records/test/summary/path/text()")[x].each do |id|
128
+
129
+ test_id = id
130
+ puts 'testing id: ' + id.inspect
131
+ result = test_id(id)
132
+ break if result == false and break_on_fail
133
+
134
+ end
135
+
136
+ rescue
122
137
 
123
- result = test_id(id)
124
- break if result == false and break_on_fail
138
+ @success << [false, test_id.to_i]
125
139
  end
140
+
126
141
 
127
142
  end
128
143
 
@@ -132,7 +147,7 @@ module Testdata
132
147
  path_no, inputs, input_names, type, expected, @desc =
133
148
  testdata_values(id.to_s)
134
149
  @inputs = inputs
135
- #puts 'after inputs'
150
+
136
151
  tests() # load the routes
137
152
 
138
153
  raw_actual = run_route type
@@ -153,10 +168,10 @@ module Testdata
153
168
  inputs = input_names.zip(inputs).map{|x| ' ' + x.join(": ")}\
154
169
  .join("\n")
155
170
 
156
- puts "\ninputs: \n" + inputs
157
- puts "\ntype or description:\n %s: %s" % [type, @desc]
158
- puts "\nexpected : \n " + b.inspect
159
- puts "\nactual : \n " + a.inspect + "\n"
171
+ puts "\ninputs: \n".bold + inputs
172
+ puts "\ntype or description:".bold + "\n %s %s".cyan % [type, @desc]
173
+ puts "\nexpected : \n ".bold + b.inspect
174
+ puts "\nactual : \n ".bold + a.inspect + "\n"
160
175
  end
161
176
 
162
177
  result = a == b
@@ -164,7 +179,13 @@ module Testdata
164
179
  if (@debug == true or @debug2 == true) and result == false then
165
180
 
166
181
  # diff the expected and actual valuess
167
- puts Diffy::Diff.new(a.first, b.first)
182
+ r = Diffy::Diff.new(a.first, b.first).to_s
183
+ r2 = r.lines.map do |line|
184
+ line.sub(/^\- {4}/) {|x| "- ".light_green}\
185
+ .sub(/^\+ {4}/) {|x| "+ ".light_red}
186
+ end
187
+ #puts 'r: ' + r.lines.inspect
188
+ puts r2
168
189
  end
169
190
  else
170
191
  result = [raw_actual].compact == expected
@@ -191,7 +212,7 @@ module Testdata
191
212
  end
192
213
 
193
214
  def read_rdx(buffer)
194
-
215
+ puts 'inside read_rdf: buffer: ' + buffer.inspect
195
216
  dx = Dynarex.new
196
217
  dx.import buffer
197
218
 
@@ -216,7 +237,8 @@ module Testdata
216
237
 
217
238
  px.create.test(path: (i+1).to_s, type: dx.test_type) do |create|
218
239
 
219
- raw_inputs.each do |fld_in|
240
+ raw_inputs.each do |fld_in|
241
+
220
242
  create.input(fld_in[0..-4].to_sym => \
221
243
  x.method(fld_in.to_sym).call)
222
244
  end
@@ -250,6 +272,7 @@ module Testdata
250
272
  end
251
273
 
252
274
  def read_td(buffer)
275
+ puts 'buffer: ' + buffer
253
276
  TestdataText.parse buffer
254
277
  end
255
278
 
@@ -261,11 +284,19 @@ module Testdata
261
284
  def summary()
262
285
  success = @success.map(&:first)
263
286
  a = @success.map(&:last).sort
264
- {
287
+ h = {
265
288
  passed: success.all?,
266
289
  score: [success.grep(true), success].map(&:length).join('/'),
267
290
  failed: @success.select{|x| x[0] == false}.map(&:last).sort
268
291
  }
292
+
293
+ def h.to_s()
294
+ passed = self[:passed] ? self[:passed].to_s.light_green : self[:passed].to_s.light_red
295
+ "{passed: #{passed}, score: #{self[:score]}, failed: #{self[:failed]}}"
296
+
297
+ end
298
+
299
+ h
269
300
  end
270
301
  end
271
302
 
@@ -327,4 +358,4 @@ end
327
358
 
328
359
  end
329
360
  end
330
- end
361
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testdata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -10,28 +10,32 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE2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+ c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEATciFgyRCUKVEJFrO291gbPIEAkeCsLtCRxB0Qz7R
29
+ Z/7bcVTdrk8/S2VQupuuni8UGeIQuxMTIkoWshCztNrIJ77xxdvk6/WqKqyxeRyZ
30
+ WKp6dPBvK0CXPRnboicdgWyiJZFr8WXGHmJuRG+SIhMPjR552kTpoKuUqf/aMs0q
31
+ krS/PjRP7MX2lCx2ZYi6/CdwyJmI5tO4ffXBNFpfquiwAa/tzPKKpbzEFjuUdTs0
32
+ ByW7I/n/h2fQkhR+/hbzh/xzCuRatkvUkAHmtW1StGSbPn0Hoam6hwWp+NuuUfEU
33
+ tA2AMgGW5/Ft/vBLFyCfMr/9x6QJEW3VtfwqL8zie4jp2sVCrW1gdotA3+4XdaEF
34
+ fUI/y8o+W/4oN7aCyhUzCXTSlGzwEHLqqCYX3DFerUd+mdQhSNLYAQuJtj/4zoNc
35
+ U1Tt/KPr9FeWlvj5ihis4H6UPWZxY2G9k94y2W7ylWkcKNXR8i45F+nCzDL3W0Ll
36
+ Vt/9GDfEI95Jg3QNvXMDdzNf
33
37
  -----END CERTIFICATE-----
34
- date: 2016-12-25 00:00:00.000000000 Z
38
+ date: 2020-09-11 00:00:00.000000000 Z
35
39
  dependencies:
36
40
  - !ruby/object:Gem::Dependency
37
41
  name: app-routes
@@ -42,7 +46,7 @@ dependencies:
42
46
  version: '0.1'
43
47
  - - ">="
44
48
  - !ruby/object:Gem::Version
45
- version: 0.1.18
49
+ version: 0.1.19
46
50
  type: :runtime
47
51
  prerelease: false
48
52
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,69 +56,69 @@ dependencies:
52
56
  version: '0.1'
53
57
  - - ">="
54
58
  - !ruby/object:Gem::Version
55
- version: 0.1.18
59
+ version: 0.1.19
56
60
  - !ruby/object:Gem::Dependency
57
61
  name: testdata_text
58
62
  requirement: !ruby/object:Gem::Requirement
59
63
  requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.1'
63
64
  - - ">="
64
65
  - !ruby/object:Gem::Version
65
- version: 0.1.8
66
+ version: 0.2.0
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.2'
66
70
  type: :runtime
67
71
  prerelease: false
68
72
  version_requirements: !ruby/object:Gem::Requirement
69
73
  requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '0.1'
73
74
  - - ">="
74
75
  - !ruby/object:Gem::Version
75
- version: 0.1.8
76
+ version: 0.2.0
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '0.2'
76
80
  - !ruby/object:Gem::Dependency
77
- name: diffy
81
+ name: diffyc32
78
82
  requirement: !ruby/object:Gem::Requirement
79
83
  requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.0'
83
84
  - - ">="
84
85
  - !ruby/object:Gem::Version
85
- version: 3.0.7
86
+ version: 0.1.0
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.1'
86
90
  type: :runtime
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
93
  requirements:
90
- - - "~>"
91
- - !ruby/object:Gem::Version
92
- version: '3.0'
93
94
  - - ">="
94
95
  - !ruby/object:Gem::Version
95
- version: 3.0.7
96
+ version: 0.1.0
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.1'
96
100
  - !ruby/object:Gem::Dependency
97
101
  name: polyrex
98
102
  requirement: !ruby/object:Gem::Requirement
99
103
  requirements:
100
104
  - - "~>"
101
105
  - !ruby/object:Gem::Version
102
- version: '1.0'
106
+ version: '1.3'
103
107
  - - ">="
104
108
  - !ruby/object:Gem::Version
105
- version: 1.0.6
109
+ version: 1.3.1
106
110
  type: :runtime
107
111
  prerelease: false
108
112
  version_requirements: !ruby/object:Gem::Requirement
109
113
  requirements:
110
114
  - - "~>"
111
115
  - !ruby/object:Gem::Version
112
- version: '1.0'
116
+ version: '1.3'
113
117
  - - ">="
114
118
  - !ruby/object:Gem::Version
115
- version: 1.0.6
119
+ version: 1.3.1
116
120
  description:
117
- email: james@r0bertson.co.uk
121
+ email: james@jamesrobertson.eu
118
122
  executables: []
119
123
  extensions: []
120
124
  extra_rdoc_files: []
@@ -139,9 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
143
  - !ruby/object:Gem::Version
140
144
  version: '0'
141
145
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.5.1
146
+ rubygems_version: 3.0.3
144
147
  signing_key:
145
148
  specification_version: 4
146
- summary: testdata
149
+ summary: A test framework which accepts test data in a Polyrex format.
147
150
  test_files: []
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- 2g��S���y2�RdNu��Z���э�1?j�Y��b9�=P�g]F��o>��2�߈ �T�3�^�P��$L:�����ۤ���.���<Ec�KE�0�����7���;|!d8��$ؔ-eY
2
- ���&_��Q KX��r սأ}ۧy�ɇ8���:�~`���X3��˞Do��eJ׋�� 狠J��<�%� i֣;�R�#Jv��$��B���]g���O߆Ѳ�F����
1
+ HT��1����1���=
2
+ ��♯�RP#�R��ȴ���R(����#]�m�6��bŦ�4�'�'������%�Q��ֹ�/�G���`�n��Vh6LGE1��,�v-��Slf {�����4���`�q��e��;U��d�����ك����-�y��bW���ϫ�3~�35�-lo
3
+ �����̂���.P3n#��