test_ids 1.1.2 → 1.2.0

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
  SHA256:
3
- metadata.gz: 2715a10e5e999b8e7cb1d8240803232fadf178139e64a2f44186d69b65602a15
4
- data.tar.gz: 2b550ced04afc190362992970a7cfaeb76e7ba78d519894ebdeb04391cd3b721
3
+ metadata.gz: c45579faaf12aa3964acd4caa219e9b3443c366d2186870a5ea86381376dbeae
4
+ data.tar.gz: 1cb178416379a578fa91c472ce7e4d22521a428bfc40d400ea52127b10dd1c8e
5
5
  SHA512:
6
- metadata.gz: 4d62fc377c3bcbd5e840ed16c17e3749d7611f95e89eee17fe4bfa5ae7b572e6db8f12bf6016393f103e3dc2c59363205b5c90ad8ad999d43d87ba52017fd349
7
- data.tar.gz: dfe969df5389777ea3545f506b78046b0d5596d49fc37890b7eab748329337ee955050ed6756c0977d22420408b6329c1dcaab1f400e0d8ef744c386bd197f13
6
+ metadata.gz: cc9951b84d9f7754d3225461157b6cd7579e6745c22ec8de0bb60ab91bc51d9f48ffdecf2c136329506fde707df173ba8e238233190e4236b62793beef92c06c
7
+ data.tar.gz: a04f02f1207e4599a3c0cb5d986b4e28741206afaf64e530b9d47dd86849b2c4a322e1a6c35e45284d727731d2bd592b4a5f4306b9eade6ccde0087062e01272
@@ -1,8 +1,7 @@
1
1
  module TestIds
2
2
  MAJOR = 1
3
- MINOR = 1
4
- BUGFIX = 2
3
+ MINOR = 2
4
+ BUGFIX = 0
5
5
  DEV = nil
6
-
7
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
7
  end
@@ -28,11 +28,26 @@ module TestIds
28
28
  # If a numeric number is passed to the softbin, it uses that number.
29
29
  # The configuration for the TestId plugin needs to pass in the bin number and the options from the test flow
30
30
  # For this method to work as intended.
31
- def next_in_range(range, options)
32
- range_item(range, options)
31
+ # This will handle the following range inputs:
32
+ # - Range, Ex: 0..10
33
+ # - Array, Ex: [0..10, 20..30]
34
+ def next_in_range(range_definition, options)
35
+ if range_definition.is_a?(Range)
36
+ range = range_definition.to_a
37
+ elsif range_definition.is_a?(Array)
38
+ range = []
39
+ range_definition.each do |range_element|
40
+ range += range_element.is_a?(Integer) ? [range_element] : range_element.step(options[:size]).to_a
41
+ end
42
+ if range.uniq.size != range.size
43
+ Origen.log.error "Duplicate or overlapping range has been detected in configuration: \'#{TestIds.current_configuration.id}\'."
44
+ fail
45
+ end
46
+ end
47
+ range_item(range, range_definition, options)
33
48
  end
34
49
 
35
- def range_item(range, options)
50
+ def range_item(range, range_definition, options)
36
51
  # This is the actual fix, it should now not be dependent on the json file being read in, instead the store pointers
37
52
  # will be utilized to get the correct number assigned from the range.
38
53
  if store['pointers']['ranges'].nil?
@@ -43,33 +58,33 @@ module TestIds
43
58
  end
44
59
  orig_options = options.dup
45
60
  # Check the database to see if the passed in range has already been included in the database hash
46
- if rangehash.key?(:"#{range}")
61
+ if rangehash.key?(:"#{range_definition}")
47
62
  # Read out the database hash to see what the last_softbin given out was for that range.
48
63
  # This hash is updated whenever a new softbin is assigned, so it should have the updated values for each range.
49
- previous_assigned_value = rangehash[:"#{range}"].to_i
64
+ previous_assigned_value = rangehash[:"#{range_definition}"].to_i
50
65
  # Now calculate the new pointer.
51
- @pointer = previous_assigned_value - range.min
66
+ @pointer = range.index(previous_assigned_value) + 1
52
67
  # Check if the last_softbin given out is the same as the range[@pointer],
53
68
  # if so increment pointer by softbin size, default size is 1, config.softbins.size is configurable.
54
69
  # from example above, pointer was calculated as 1,range[1] is 10101 and is same as last_softbin, so pointer is incremented
55
70
  # and new value is assigned to the softbin.
56
- if previous_assigned_value == range.to_a[@pointer]
71
+ if previous_assigned_value == range[@pointer]
57
72
  @pointer += options[:size]
58
- assigned_value = range.to_a[@pointer]
73
+ assigned_value = range[@pointer]
59
74
  else
60
75
  # Because of the pointer calculations above, I don't think it will ever reach here, has not in my test cases so far!
61
- assigned_value = range.to_a[@pointer]
76
+ assigned_value = range[@pointer]
62
77
  end
63
78
  # Now update the database pointers to point to the lastest assigned softbin for a given range.
64
- rangehash.merge!(:"#{range}" => "#{range.to_a[@pointer]}")
79
+ rangehash.merge!(:"#{range_definition}" => "#{range[@pointer]}")
65
80
  else
66
81
  # This is the case for a brand new range that has not been passed before
67
82
  # We start from the first value as the assigned softbin and update the database to reflect.
68
83
  @pointer = 0
69
- rangehash.merge!(:"#{range}" => "#{range.to_a[@pointer]}")
70
- assigned_value = range.to_a[@pointer]
84
+ rangehash.merge!(:"#{range_definition}" => "#{range[@pointer]}")
85
+ assigned_value = range[@pointer]
71
86
  end
72
- unless !assigned_value.nil? && assigned_value.between?(range.min, range.max)
87
+ unless !assigned_value.nil? && range.include?(assigned_value)
73
88
  Origen.log.error 'Assigned value not in range'
74
89
  fail
75
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_ids
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-23 00:00:00.000000000 Z
11
+ date: 2020-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.40
19
+ version: 0.57.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.7.40
26
+ version: 0.57.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: origen_testers
29
29
  requirement: !ruby/object:Gem::Requirement