Made unit tests more robust

This commit is contained in:
Matthias Koefferlein 2025-02-16 15:07:37 +01:00
parent ae5ae25000
commit 094fccce74
5 changed files with 26 additions and 2 deletions

View File

@ -41,7 +41,7 @@ class EdgeNeighborhoodWithNetsVisitor(pya.EdgeNeighborhoodVisitor):
self.poly[str(edge)] = edge_data
for (x1, x2), polygons in neighborhood:
for inp, poly in polygons.items():
poly_str = "/".join([ str(p) for p in poly ])
poly_str = "/".join(sorted([ str(p) for p in poly ]))
edge_data.append(f"{x1},{x2} -> {inp}: {poly_str}")
def dump(self):
@ -282,7 +282,7 @@ Polygon: (-9500,0;-9500,15000;0,15000;0,0;-5000,0;-5000,12000;-6500,12000;-6500,
0.0,2500.0 -> 3: (0,-11;0,0;2500,0;2500,-11) props={net=>net1}
2500.0,3000.0 -> 0: (2500,-11;2500,0;3000,0;3000,-11) props={net=>net1}
2500.0,3000.0 -> 1: (2500,1500;2500,5000;3000,5000;3000,1500) props={net=>net3}
2500.0,3000.0 -> 3: (2500,1500;2500,5000;3000,5000;3000,1500) props={net=>net2}/(2500,-11;2500,0;3000,0;3000,-11) props={net=>net1}
2500.0,3000.0 -> 3: (2500,-11;2500,0;3000,0;3000,-11) props={net=>net1}/(2500,1500;2500,5000;3000,5000;3000,1500) props={net=>net2}
3000.0,9500.0 -> 0: (3000,-11;3000,0;9500,0;9500,-11) props={net=>net1}
3000.0,9500.0 -> 1: (3000,1500;3000,5000;9500,5000;9500,1500) props={net=>net3}
3000.0,9500.0 -> 3: (3000,1500;3000,5000;9500,5000;9500,1500) props={net=>net2}

View File

@ -244,6 +244,8 @@ class DBEdgePairs_TestClass < TestBase
assert_equal(r.is_deep?, true)
dss._destroy
end
def test_4
@ -282,6 +284,8 @@ class DBEdgePairs_TestClass < TestBase
assert_equal(RBA::Region::new(target.cell("TOP").shapes(target_li)).to_s, "")
assert_equal(RBA::Region::new(target.cell("C2").shapes(target_li)).to_s, "(-1,-1;-1,11;11,11;11,-1)")
dss._destroy
end
def test_5
@ -646,6 +650,8 @@ class DBEdgePairs_TestClass < TestBase
rr.filter(RBA::EdgePairFilter::property_filter("one", 17))
assert_equal(csort(rr.to_s), csort("(1,1;101,201)/(1,11;101,211){one=>17}"))
dss._destroy
end
end

View File

@ -780,6 +780,8 @@ class DBEdges_TestClass < TestBase
assert_equal(r.hier_count, 12)
assert_equal(r.to_s, "(-10,-20;-10,20);(-10,20;10,20);(10,20;10,-20);(10,-20;-10,-20);(-10,80;-10,120);(-10,120;10,120);(10,120;10,80);(10,80;-10,80);(190,80;190,120);(190,120;210,120)...")
dss._destroy
end
# inside
@ -1085,6 +1087,8 @@ class DBEdges_TestClass < TestBase
rr.filter(RBA::EdgeFilter::property_filter("one", 17))
assert_equal(csort(rr.to_s), csort("(1,1;101,201){one=>17}"))
dss._destroy
end
end

View File

@ -1049,6 +1049,8 @@ class DBRegion_TestClass < TestBase
assert_equal(t.to_s, "(99,199;99,201;101,201;101,199)")
assert_equal(t.is_deep?, true)
dss._destroy
r = RBA::Region::new(top.begin_shapes_rec(l1))
t = r.texts_dots("*", true)
assert_equal(t.to_s, "(100,200;100,200)")
@ -1060,6 +1062,8 @@ class DBRegion_TestClass < TestBase
assert_equal(t.to_s, "(100,200;100,200)")
assert_equal(t.is_deep?, true)
dss._destroy
end
# regions from Shapes
@ -1522,6 +1526,8 @@ class DBRegion_TestClass < TestBase
assert_equal(r.to_s, "(0,0;0,1000;1000,1000;1000,0);(1000,1000;1000,2000;2000,2000;2000,1000)")
assert_equal(r.bbox.to_s, "(0,0;2000,2000)")
dss._destroy
end
# properties
@ -1631,6 +1637,8 @@ class DBRegion_TestClass < TestBase
rr.filter(RBA::PolygonFilter::property_filter("one", 17))
assert_equal(csort(rr.to_s), csort("(1,1;1,201;101,201;101,1){one=>17}"))
dss._destroy
end
end

View File

@ -242,6 +242,8 @@ class DBTexts_TestClass < TestBase
assert_equal(r.is_deep?, true)
dss._destroy
end
def test_4
@ -342,6 +344,8 @@ class DBTexts_TestClass < TestBase
assert_equal(RBA::Texts::new(target.cell("C2").shapes(target_li)).to_s, "('abc',r0 100,-200)")
assert_equal(RBA::Region::new(target.cell("C2").shapes(target_li)).to_s, "")
dss._destroy
end
# interact
@ -515,6 +519,8 @@ class DBTexts_TestClass < TestBase
rr.filter(RBA::TextFilter::property_filter("one", 17))
assert_equal(csort(rr.to_s), csort("('uvw',r0 0,0){one=>17}"))
dss._destroy
end
end