mirror of https://github.com/KLayout/klayout.git
Fixed unbounded ranges compatibility for Ruby < 2.7
This commit is contained in:
parent
73485a5061
commit
66ea75e643
|
|
@ -1,12 +1,7 @@
|
|||
|
||||
# Interact with count
|
||||
|
||||
has_unbounded_range = false
|
||||
begin
|
||||
r = eval("..2")
|
||||
has_unbounded_range = true
|
||||
rescue => ex
|
||||
end
|
||||
has_unbounded_range = ((RUBY_VERSION.split(".").map(&:to_i) <=> [2,7,0]) <= 0)
|
||||
|
||||
source($drc_test_source, "TOP")
|
||||
target($drc_test_target)
|
||||
|
|
@ -21,7 +16,7 @@ l1.interacting(l2, 1).output(100, 0)
|
|||
l1.interacting(l2, 2).output(101, 0)
|
||||
l1.interacting(l2, 1..2).output(102, 0)
|
||||
if has_unbounded_range
|
||||
l1.interacting(l2, 2..).output(103, 0)
|
||||
l1.interacting(l2, eval("2..")).output(103, 0)
|
||||
else
|
||||
l1.interacting(l2, 2..10000).output(103, 0)
|
||||
end
|
||||
|
|
@ -31,7 +26,7 @@ l1.overlapping(l2, 1).output(110, 0)
|
|||
l1.overlapping(l2, 2).output(111, 0)
|
||||
l1.overlapping(l2, 1..2).output(112, 0)
|
||||
if has_unbounded_range
|
||||
l1.overlapping(l2, 2..).output(113, 0)
|
||||
l1.overlapping(l2, eval("2..")).output(113, 0)
|
||||
else
|
||||
l1.overlapping(l2, 2..10000).output(113, 0)
|
||||
end
|
||||
|
|
@ -48,7 +43,7 @@ l.select_interacting(l2, 1..2)
|
|||
l.output(202, 0)
|
||||
l = l1.dup
|
||||
if has_unbounded_range
|
||||
l.select_interacting(l2, 2..)
|
||||
l.select_interacting(l2, eval("2.."))
|
||||
else
|
||||
l.select_interacting(l2, 2..10000)
|
||||
end
|
||||
|
|
@ -68,7 +63,7 @@ l.select_overlapping(l2, 1..2)
|
|||
l.output(212, 0)
|
||||
l = l1.dup
|
||||
if has_unbounded_range
|
||||
l.select_overlapping(l2, 2..)
|
||||
l.select_overlapping(l2, eval("2.."))
|
||||
else
|
||||
l.select_overlapping(l2, 2..10000)
|
||||
end
|
||||
|
|
@ -81,7 +76,7 @@ l1.not_interacting(l2, 1).output(300, 0)
|
|||
l1.not_interacting(l2, 2).output(301, 0)
|
||||
l1.not_interacting(l2, 1..2).output(302, 0)
|
||||
if has_unbounded_range
|
||||
l1.not_interacting(l2, 2..).output(303, 0)
|
||||
l1.not_interacting(l2, eval("2..")).output(303, 0)
|
||||
else
|
||||
l1.not_interacting(l2, 2..10000).output(303, 0)
|
||||
end
|
||||
|
|
@ -90,7 +85,7 @@ l1.not_interacting(l2, 1, 2).output(304, 0)
|
|||
l1.not_overlapping(l2, 1).output(310, 0)
|
||||
l1.not_overlapping(l2, 2).output(311, 0)
|
||||
l1.not_overlapping(l2, 1..2).output(312, 0)
|
||||
l1.not_overlapping(l2, 2..).output(313, 0)
|
||||
l1.not_overlapping(l2, eval("2..")).output(313, 0)
|
||||
l1.not_overlapping(l2, 1, 2).output(314, 0)
|
||||
|
||||
l = l1.dup
|
||||
|
|
@ -104,7 +99,7 @@ l.select_not_interacting(l2, 1..2)
|
|||
l.output(402, 0)
|
||||
l = l1.dup
|
||||
if has_unbounded_range
|
||||
l.select_not_interacting(l2, 2..)
|
||||
l.select_not_interacting(l2, eval("2.."))
|
||||
else
|
||||
l.select_not_interacting(l2, 2..10000)
|
||||
end
|
||||
|
|
@ -124,7 +119,7 @@ l.select_not_overlapping(l2, 1..2)
|
|||
l.output(412, 0)
|
||||
l = l1.dup
|
||||
if has_unbounded_range
|
||||
l.select_not_overlapping(l2, 2..)
|
||||
l.select_not_overlapping(l2, eval("2.."))
|
||||
else
|
||||
l.select_not_overlapping(l2, 2..10000)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
|
||||
has_unbounded_range = false
|
||||
begin
|
||||
r = eval("..2")
|
||||
has_unbounded_range = true
|
||||
rescue => ex
|
||||
end
|
||||
has_unbounded_range = ((RUBY_VERSION.split(".").map(&:to_i) <=> [2,7,0]) <= 0)
|
||||
|
||||
source $drc_test_source
|
||||
target $drc_test_target
|
||||
|
|
@ -37,7 +32,7 @@ l1.non_squares.output(111, 0)
|
|||
l2.with_bbox_aspect_ratio(2).output(120, 0)
|
||||
l2.with_bbox_aspect_ratio(1).output(121, 0)
|
||||
if has_unbounded_range
|
||||
l2.with_bbox_aspect_ratio(..1).output(122, 0)
|
||||
l2.with_bbox_aspect_ratio(eval("..1")).output(122, 0)
|
||||
else
|
||||
l2.with_bbox_aspect_ratio(0..1).output(122, 0)
|
||||
end
|
||||
|
|
@ -46,7 +41,7 @@ l2.without_bbox_aspect_ratio(0..2).output(123, 0)
|
|||
l2.with_relative_height(2).output(130, 0)
|
||||
l2.with_relative_height(1).output(131, 0)
|
||||
if has_unbounded_range
|
||||
l2.with_relative_height(..1).output(132, 0)
|
||||
l2.with_relative_height(eval("..1")).output(132, 0)
|
||||
else
|
||||
l2.with_relative_height(0..1).output(132, 0)
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue