test_ids 1.1.2 → 1.2.0
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 +4 -4
- data/config/version.rb +2 -3
- data/lib/test_ids/allocator.rb +28 -13
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c45579faaf12aa3964acd4caa219e9b3443c366d2186870a5ea86381376dbeae
|
4
|
+
data.tar.gz: 1cb178416379a578fa91c472ce7e4d22521a428bfc40d400ea52127b10dd1c8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc9951b84d9f7754d3225461157b6cd7579e6745c22ec8de0bb60ab91bc51d9f48ffdecf2c136329506fde707df173ba8e238233190e4236b62793beef92c06c
|
7
|
+
data.tar.gz: a04f02f1207e4599a3c0cb5d986b4e28741206afaf64e530b9d47dd86849b2c4a322e1a6c35e45284d727731d2bd592b4a5f4306b9eade6ccde0087062e01272
|
data/config/version.rb
CHANGED
data/lib/test_ids/allocator.rb
CHANGED
@@ -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
|
-
|
32
|
-
|
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?(:"#{
|
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[:"#{
|
64
|
+
previous_assigned_value = rangehash[:"#{range_definition}"].to_i
|
50
65
|
# Now calculate the new pointer.
|
51
|
-
@pointer = previous_assigned_value
|
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
|
71
|
+
if previous_assigned_value == range[@pointer]
|
57
72
|
@pointer += options[:size]
|
58
|
-
assigned_value = range
|
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
|
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!(:"#{
|
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!(:"#{
|
70
|
-
assigned_value = range
|
84
|
+
rangehash.merge!(:"#{range_definition}" => "#{range[@pointer]}")
|
85
|
+
assigned_value = range[@pointer]
|
71
86
|
end
|
72
|
-
unless !assigned_value.nil? &&
|
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.
|
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-
|
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.
|
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.
|
26
|
+
version: 0.57.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: origen_testers
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|