mirror of https://github.com/KLayout/klayout.git
Added some tests for 'switch', small bug fix.
This commit is contained in:
parent
ec88362eca
commit
bbd511bc8b
|
|
@ -1516,8 +1516,8 @@ class DRCOpNodeCase < DRCOpNode
|
|||
types << a.result_type
|
||||
end
|
||||
end
|
||||
if types.sort.uniq.size > 1
|
||||
raise("All result arguments need to have the same type (we got '" + types.collect(:to_s).join(",") + "')")
|
||||
if types.uniq { |a,b| a.to_i <=> b.to_i }.size > 1
|
||||
raise("All result arguments of 'switch' need to render the same type (got '" + types.map!(&:to_s).join(",") + "')")
|
||||
end
|
||||
|
||||
RBA::CompoundRegionOperationNode::new_case(nodes)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ l3.output(3, 0)
|
|||
l1.drc(rectangles).output(100, 0)
|
||||
l1.drc(primary.rectangles).output(101, 0)
|
||||
l2.drc(secondary(l1).rectangles).output(102, 0)
|
||||
l1.drc(squares).output(103, 0)
|
||||
l1.drc(primary.squares).output(104, 0)
|
||||
l2.drc(secondary(l1).squares).output(105, 0)
|
||||
|
||||
l1.drc(rectilinear).output(110, 0)
|
||||
l1.drc(primary.rectilinear).output(111, 0)
|
||||
|
|
@ -37,8 +40,24 @@ l1.drc(! rectilinear).output(140, 0)
|
|||
l1.drc(! rectangles).output(141, 0)
|
||||
|
||||
l1.drc(if_all(! rectangles, area < 8.0)).output(150, 0)
|
||||
l1.drc(if_any(rectangles, area > 8.0)).output(151, 0)
|
||||
l1.drc(if_any(rectangles, area >= 8.0)).output(151, 0)
|
||||
|
||||
l1.drc(if_any(corners.count > 4)).output(160, 0)
|
||||
l1.drc(if_any(corners.count == 4)).output(161, 0)
|
||||
|
||||
l1.drc(switch(! rectangles, primary.sized(100.nm))).output(170, 0)
|
||||
l1.drc(switch(! rectangles, primary.sized(100.nm), primary.sized(200.nm))).output(171, 0)
|
||||
|
||||
error = ""
|
||||
begin
|
||||
l1.drc(switch(! rectangles, primary.sized(100.nm), squares, primary.sized(200.nm).edges))
|
||||
rescue => ex
|
||||
error = ex.to_s
|
||||
end
|
||||
if error != "'drc': All result arguments of 'switch' need to render the same type (got 'Region,Edges')"
|
||||
raise "switch did not give the right error when having different types. Was:\n" + error
|
||||
end
|
||||
|
||||
l1.drc(switch(! rectangles, primary.sized(100.nm), squares, primary.sized(200.nm))).output(172, 0)
|
||||
l1.drc(switch(! rectangles, primary.sized(100.nm), squares, primary.sized(200.nm), primary)).output(173, 0)
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue