diff --git a/testdata/pymod/bridge.py b/testdata/pymod/bridge.py index fa87aed7f..21c2aeb86 100755 --- a/testdata/pymod/bridge.py +++ b/testdata/pymod/bridge.py @@ -34,7 +34,7 @@ class BridgeTest(unittest.TestCase): p = db.DSimplePolygon(db.DBox(1,2,3,4)) a = bridge.p2a(p) pp = bridge.a2p(a) - self.assertEqual(repr(pp), "(1,2;1,4;3,4;3,2)") + self.assertEqual(str(pp), "(1,2;1,4;3,4;3,2)") self.assertEqual(type(pp).__name__, "DSimplePolygon") # run unit tests diff --git a/testdata/python/dbLayoutToNetlist.py b/testdata/python/dbLayoutToNetlist.py index 161bd3bc3..b305d9927 100644 --- a/testdata/python/dbLayoutToNetlist.py +++ b/testdata/python/dbLayoutToNetlist.py @@ -117,11 +117,11 @@ circuit RINGO (); end; """) - self.assertEqual(repr(l2n.probe_net(rmetal2, pya.DPoint(0.0, 1.8))), "RINGO:FB") + self.assertEqual(str(l2n.probe_net(rmetal2, pya.DPoint(0.0, 1.8))), "RINGO:FB") self.assertEqual(repr(l2n.probe_net(rmetal2, pya.DPoint(-2.0, 1.8))), "None") n = l2n.probe_net(rmetal1, pya.Point(2600, 1000)) - self.assertEqual(repr(n), "RINGO:$I20") + self.assertEqual(str(n), "RINGO:$I20") self.assertEqual(str(l2n.shapes_of_net(n, rmetal1, True)), "(1660,-420;1660,2420;2020,2420;2020,-420);(1840,820;1840,1180;3220,1180;3220,820);(1660,2420;1660,3180;2020,3180;2020,2420);(1660,-380;1660,380;2020,380;2020,-380)") diff --git a/testdata/python/dbPolygonTest.py b/testdata/python/dbPolygonTest.py index f2cdf0194..f98597d07 100644 --- a/testdata/python/dbPolygonTest.py +++ b/testdata/python/dbPolygonTest.py @@ -21,6 +21,12 @@ import pya import unittest import sys +def astr(a): + astr = [] + for i in a: + astr.append(str(i)) + return "[" + ", ".join(astr) + "]" + class DBPolygonTests(unittest.TestCase): # DPolygon basics @@ -490,17 +496,17 @@ class DBPolygonTests(unittest.TestCase): p = pya.Polygon.from_s("(0,0;0,40;40,40;40,0/10,10;30,10;30,30;10,30)") - self.assertEqual(str(p.decompose_convex()), "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") - self.assertEqual(str(p.decompose_convex(pya.Polygon.PO_any)), "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") - self.assertEqual(str(p.decompose_convex(pya.Polygon.PO_horizontal)), "[(0,10;0,30;10,30;10,10), (0,30;0,40;40,40;40,30), (30,10;30,30;40,30;40,10), (0,0;0,10;40,10;40,0)]") - self.assertEqual(str(p.decompose_convex(pya.Polygon.PO_vertical)), "[(10,0;10,10;30,10;30,0), (0,0;0,40;10,40;10,0), (10,30;10,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") - self.assertEqual(str(p.decompose_convex(pya.Polygon.PO_htrapezoids)), "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") - self.assertEqual(str(p.decompose_convex(pya.Polygon.PO_vtrapezoids)), "[(10,0;10,10;30,10;30,0), (0,0;0,30;10,30;10,0), (0,30;0,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") + self.assertEqual(astr(p.decompose_convex()), "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") + self.assertEqual(astr(p.decompose_convex(pya.Polygon.PO_any)), "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") + self.assertEqual(astr(p.decompose_convex(pya.Polygon.PO_horizontal)), "[(0,10;0,30;10,30;10,10), (0,30;0,40;40,40;40,30), (30,10;30,30;40,30;40,10), (0,0;0,10;40,10;40,0)]") + self.assertEqual(astr(p.decompose_convex(pya.Polygon.PO_vertical)), "[(10,0;10,10;30,10;30,0), (0,0;0,40;10,40;10,0), (10,30;10,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") + self.assertEqual(astr(p.decompose_convex(pya.Polygon.PO_htrapezoids)), "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") + self.assertEqual(astr(p.decompose_convex(pya.Polygon.PO_vtrapezoids)), "[(10,0;10,10;30,10;30,0), (0,0;0,30;10,30;10,0), (0,30;0,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") - self.assertEqual(str(p.decompose_trapezoids()), "[(0,0;0,10;40,10;40,0), (0,10;0,30;10,30;10,10), (30,10;30,30;40,30;40,10), (0,30;0,40;40,40;40,30)]") - self.assertEqual(str(p.decompose_trapezoids(pya.Polygon.TD_simple)), "[(0,0;0,10;40,10;40,0), (0,10;0,30;10,30;10,10), (30,10;30,30;40,30;40,10), (0,30;0,40;40,40;40,30)]") - self.assertEqual(str(p.decompose_trapezoids(pya.Polygon.TD_htrapezoids)), "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") - self.assertEqual(str(p.decompose_trapezoids(pya.Polygon.TD_vtrapezoids)), "[(10,0;10,10;30,10;30,0), (0,0;0,30;10,30;10,0), (0,30;0,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") + self.assertEqual(astr(p.decompose_trapezoids()), "[(0,0;0,10;40,10;40,0), (0,10;0,30;10,30;10,10), (30,10;30,30;40,30;40,10), (0,30;0,40;40,40;40,30)]") + self.assertEqual(astr(p.decompose_trapezoids(pya.Polygon.TD_simple)), "[(0,0;0,10;40,10;40,0), (0,10;0,30;10,30;10,10), (30,10;30,30;40,30;40,10), (0,30;0,40;40,40;40,30)]") + self.assertEqual(astr(p.decompose_trapezoids(pya.Polygon.TD_htrapezoids)), "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") + self.assertEqual(astr(p.decompose_trapezoids(pya.Polygon.TD_vtrapezoids)), "[(10,0;10,10;30,10;30,0), (0,0;0,30;10,30;10,0), (0,30;0,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") # polygon decomposition def test_extractRad(self): diff --git a/testdata/python/layLayers.py b/testdata/python/layLayers.py index ccdf2c394..51b4e3b86 100644 --- a/testdata/python/layLayers.py +++ b/testdata/python/layLayers.py @@ -21,6 +21,11 @@ import unittest import os import sys +def astr(a): + astr = [] + for i in a: + astr.append(str(i)) + return "[" + ", ".join(astr) + "]" class LAYLayersTest(unittest.TestCase): @@ -139,7 +144,7 @@ class LAYLayersTest(unittest.TestCase): l12_new.source = "@* (0,0 *0.5) (0,5 r45 *2.5)" cv.set_layer_properties(p12, l12_new) trans = p12.current().trans_(True) - self.assertEqual(str(trans), str(p12.current().trans)) + self.assertEqual(astr(trans), astr(p12.current().trans)) self.assertEqual(len(trans), 2) self.assertEqual(str(trans [0]), "r0 *0.5 0,0") self.assertEqual(str(trans [1]), "r45 *2.5 0,5") diff --git a/testdata/python/tlTest.py b/testdata/python/tlTest.py index c7764a8e1..c20b5df95 100644 --- a/testdata/python/tlTest.py +++ b/testdata/python/tlTest.py @@ -20,6 +20,12 @@ import pya import unittest import sys +def astr(a): + astr = [] + for i in a: + astr.append(str(i)) + return "[" + ", ".join(astr) + "]" + class TLTest(unittest.TestCase): def test_1(self): @@ -114,7 +120,7 @@ class TLTest(unittest.TestCase): expr = pya.Expression("x=a&b; y=x; z=y; [x,y,z]", { "a": box1, "b": box2, "x": None, "y": None, "z": None }) res = expr.eval() - self.assertEqual(str(res), "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") + self.assertEqual(astr(res), "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") # all objects are individual copies self.assertNotEqual(id(res[0]), id(box1)) @@ -129,7 +135,7 @@ class TLTest(unittest.TestCase): expr = pya.Expression("var x=a&b; var y=x; var z=y; [x,y,z]", { "a": box1, "b": box2 }) res = expr.eval() - self.assertEqual(str(res), "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") + self.assertEqual(astr(res), "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") # all objects are individual copies self.assertNotEqual(id(res[0]), id(box1)) @@ -139,7 +145,7 @@ class TLTest(unittest.TestCase): # destruction of the expression's object space does not matter since we have copies expr._destroy() - self.assertEqual(str(res), "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") + self.assertEqual(astr(res), "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") # ------------------------------------------------- @@ -178,7 +184,7 @@ class TLTest(unittest.TestCase): expr = pya.Expression("x=a&b; y=x; z=y; [x,y,z]", { "a": region1, "b": region2, "x": None, "y": None, "z": None }) res = expr.eval() - self.assertEqual(str(res), "[(50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150)]") + self.assertEqual(astr(res), "[(50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150)]") # regions are managed objects -> passing the object through the expression persists it's object ID self.assertNotEqual(id(res[0]), id(region1)) @@ -195,7 +201,7 @@ class TLTest(unittest.TestCase): expr = pya.Expression("var x=a&b; var y=x; var z=y; [x,y,z]", { "a": region1, "b": region2 }) res = expr.eval() - self.assertEqual(str(res), "[(50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150)]") + self.assertEqual(astr(res), "[(50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150)]") # regions are managed objects -> passing the object through the expression persists it's object ID self.assertNotEqual(id(res[0]), id(region1)) diff --git a/testdata/ruby/dbLayoutQuery.rb b/testdata/ruby/dbLayoutQuery.rb index 27e4b3e12..6b7fa1857 100644 --- a/testdata/ruby/dbLayoutQuery.rb +++ b/testdata/ruby/dbLayoutQuery.rb @@ -33,12 +33,12 @@ class DBLayoutQuery_TestClass < TestBase q = RBA::LayoutQuery::new("select cell.name, cell.bbox from *") res = [] q.each(ly) do |iter| - res << iter.data.inspect + res << iter.data.map(&:to_s).join(", ") end assert_equal(res.size, 2) - assert_equal(res[0], "[\"TOPTOP\", (0,0;32800,12800)]") - assert_equal(res[1], "[\"TOP\", (0,0;900,900)]") + assert_equal(res[0], "TOPTOP, (0,0;32800,12800)") + assert_equal(res[1], "TOP, (0,0;900,900)") end @@ -53,11 +53,11 @@ class DBLayoutQuery_TestClass < TestBase q = RBA::LayoutQuery::new("select cell.name, cell.bbox from *") res = [] q.each(ly) do |iter| - res << iter.data.inspect + res << iter.data.map(&:to_s).join(", ") end assert_equal(res.size, 1) - assert_equal(res[0], "[\"TOPTOP\", ()]") + assert_equal(res[0], "TOPTOP, ()") end diff --git a/testdata/ruby/dbLayoutToNetlist.rb b/testdata/ruby/dbLayoutToNetlist.rb index afc738ee7..41fb7ec56 100644 --- a/testdata/ruby/dbLayoutToNetlist.rb +++ b/testdata/ruby/dbLayoutToNetlist.rb @@ -153,11 +153,11 @@ circuit RINGO (); end; END - assert_equal(l2n.probe_net(rmetal2, RBA::DPoint::new(0.0, 1.8)).inspect, "RINGO:FB") + assert_equal(l2n.probe_net(rmetal2, RBA::DPoint::new(0.0, 1.8)).to_s, "RINGO:FB") assert_equal(l2n.probe_net(rmetal2, RBA::DPoint::new(-2.0, 1.8)).inspect, "nil") n = l2n.probe_net(rmetal1, RBA::Point::new(2600, 1000)) - assert_equal(n.inspect, "RINGO:$I20") + assert_equal(n.to_s, "RINGO:$I20") assert_equal(l2n.shapes_of_net(n, rmetal1, true).to_s, "(1660,-420;1660,2420;2020,2420;2020,-420);(1840,820;1840,1180;3220,1180;3220,820);(1660,2420;1660,3180;2020,3180;2020,2420);(1660,-380;1660,380;2020,380;2020,-380)") diff --git a/testdata/ruby/dbPolygonTest.rb b/testdata/ruby/dbPolygonTest.rb index e18e620aa..0aaec4869 100644 --- a/testdata/ruby/dbPolygonTest.rb +++ b/testdata/ruby/dbPolygonTest.rb @@ -495,17 +495,17 @@ class DBPolygon_TestClass < TestBase p = RBA::Polygon::from_s("(0,0;0,40;40,40;40,0/10,10;30,10;30,30;10,30)") - assert_equal(p.decompose_convex.inspect, "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") - assert_equal(p.decompose_convex(RBA::Polygon::PO_any).inspect, "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") - assert_equal(p.decompose_convex(RBA::Polygon::PO_horizontal).inspect, "[(0,10;0,30;10,30;10,10), (0,30;0,40;40,40;40,30), (30,10;30,30;40,30;40,10), (0,0;0,10;40,10;40,0)]") - assert_equal(p.decompose_convex(RBA::Polygon::PO_vertical).inspect, "[(10,0;10,10;30,10;30,0), (0,0;0,40;10,40;10,0), (10,30;10,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") - assert_equal(p.decompose_convex(RBA::Polygon::PO_htrapezoids).inspect, "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") - assert_equal(p.decompose_convex(RBA::Polygon::PO_vtrapezoids).inspect, "[(10,0;10,10;30,10;30,0), (0,0;0,30;10,30;10,0), (0,30;0,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") + assert_equal(p.decompose_convex.map(&:to_s), %w((0,10;0,30;10,30;10,10) (0,30;0,40;30,40;30,30) (30,10;30,40;40,40;40,10) (0,0;0,10;40,10;40,0))) + assert_equal(p.decompose_convex(RBA::Polygon::PO_any).map(&:to_s), %w((0,10;0,30;10,30;10,10) (0,30;0,40;30,40;30,30) (30,10;30,40;40,40;40,10) (0,0;0,10;40,10;40,0))) + assert_equal(p.decompose_convex(RBA::Polygon::PO_horizontal).map(&:to_s), %w((0,10;0,30;10,30;10,10) (0,30;0,40;40,40;40,30) (30,10;30,30;40,30;40,10) (0,0;0,10;40,10;40,0))) + assert_equal(p.decompose_convex(RBA::Polygon::PO_vertical).map(&:to_s), %w((10,0;10,10;30,10;30,0) (0,0;0,40;10,40;10,0) (10,30;10,40;30,40;30,30) (30,0;30,40;40,40;40,0))) + assert_equal(p.decompose_convex(RBA::Polygon::PO_htrapezoids).map(&:to_s), %w((0,10;0,30;10,30;10,10) (0,30;0,40;30,40;30,30) (30,10;30,40;40,40;40,10) (0,0;0,10;40,10;40,0))) + assert_equal(p.decompose_convex(RBA::Polygon::PO_vtrapezoids).map(&:to_s), %w((10,0;10,10;30,10;30,0) (0,0;0,30;10,30;10,0) (0,30;0,40;30,40;30,30) (30,0;30,40;40,40;40,0))) - assert_equal(p.decompose_trapezoids.inspect, "[(0,0;0,10;40,10;40,0), (0,10;0,30;10,30;10,10), (30,10;30,30;40,30;40,10), (0,30;0,40;40,40;40,30)]") - assert_equal(p.decompose_trapezoids(RBA::Polygon::TD_simple).inspect, "[(0,0;0,10;40,10;40,0), (0,10;0,30;10,30;10,10), (30,10;30,30;40,30;40,10), (0,30;0,40;40,40;40,30)]") - assert_equal(p.decompose_trapezoids(RBA::Polygon::TD_htrapezoids).inspect, "[(0,10;0,30;10,30;10,10), (0,30;0,40;30,40;30,30), (30,10;30,40;40,40;40,10), (0,0;0,10;40,10;40,0)]") - assert_equal(p.decompose_trapezoids(RBA::Polygon::TD_vtrapezoids).inspect, "[(10,0;10,10;30,10;30,0), (0,0;0,30;10,30;10,0), (0,30;0,40;30,40;30,30), (30,0;30,40;40,40;40,0)]") + assert_equal(p.decompose_trapezoids.map(&:to_s), %w((0,0;0,10;40,10;40,0) (0,10;0,30;10,30;10,10) (30,10;30,30;40,30;40,10) (0,30;0,40;40,40;40,30))) + assert_equal(p.decompose_trapezoids(RBA::Polygon::TD_simple).map(&:to_s), %w((0,0;0,10;40,10;40,0) (0,10;0,30;10,30;10,10) (30,10;30,30;40,30;40,10) (0,30;0,40;40,40;40,30))) + assert_equal(p.decompose_trapezoids(RBA::Polygon::TD_htrapezoids).map(&:to_s), %w((0,10;0,30;10,30;10,10) (0,30;0,40;30,40;30,30) (30,10;30,40;40,40;40,10) (0,0;0,10;40,10;40,0))) + assert_equal(p.decompose_trapezoids(RBA::Polygon::TD_vtrapezoids).map(&:to_s), %w((10,0;10,10;30,10;30,0) (0,0;0,30;10,30;10,0) (0,30;0,40;30,40;30,30) (30,0;30,40;40,40;40,0))) end @@ -520,7 +520,7 @@ class DBPolygon_TestClass < TestBase sp = sp.round_corners(10000, 5000, 200) ex = sp.extract_rad - assert_equal(ex.inspect, "[(0,0;0,200000;300000,200000;300000,100000;100000,100000;100000,0), 10000.0, 5000.0, 200]") + assert_equal(ex.map(&:to_s), %w((0,0;0,200000;300000,200000;300000,100000;100000,100000;100000,0) 10000.0 5000.0 200)) ex = RBA::Polygon::new.extract_rad assert_equal(ex.inspect, "[]") @@ -530,7 +530,7 @@ class DBPolygon_TestClass < TestBase sp = sp.round_corners(10000, 5000, 200) ex = sp.extract_rad - assert_equal(ex.inspect, "[(0,0;0,300000;300000,300000;300000,0/100000,100000;200000,100000;200000,200000;100000,200000), 10000.0, 5000.0, 200]") + assert_equal(ex.map(&:to_s), %w((0,0;0,300000;300000,300000;300000,0/100000,100000;200000,100000;200000,200000;100000,200000) 10000.0 5000.0 200)) # double coords too ... @@ -545,7 +545,7 @@ class DBPolygon_TestClass < TestBase # round to integers for better comparison ex[0] = RBA::SimplePolygon::new(ex[0]) - assert_equal(ex.inspect, "[(0,0;0,200000;300000,200000;300000,100000;100000,100000;100000,0), 10000.0, 5000.0, 200]") + assert_equal(ex.map(&:to_s), %w((0,0;0,200000;300000,200000;300000,100000;100000,100000;100000,0) 10000.0 5000.0 200)) ex = RBA::DPolygon::new.extract_rad assert_equal(ex.inspect, "[]") @@ -558,7 +558,7 @@ class DBPolygon_TestClass < TestBase # round to integers for better comparison ex[0] = RBA::Polygon::new(ex[0]) - assert_equal(ex.inspect, "[(0,0;0,300000;300000,300000;300000,0/100000,100000;200000,100000;200000,200000;100000,200000), 10000.0, 5000.0, 200]") + assert_equal(ex.map(&:to_s), %w((0,0;0,300000;300000,300000;300000,0/100000,100000;200000,100000;200000,200000;100000,200000) 10000.0 5000.0 200)) end diff --git a/testdata/ruby/dbShapesTest.rb b/testdata/ruby/dbShapesTest.rb index 3afd983f3..2ccac70b8 100644 --- a/testdata/ruby/dbShapesTest.rb +++ b/testdata/ruby/dbShapesTest.rb @@ -152,11 +152,11 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].has_prop_id?, false ) assert_equal( arr[0].is_null?, false ) assert_equal( arr[0].type, RBA::Shape::t_box ) - assert_equal( arr[0].polygon.inspect, "(10,-10;10,40;50,40;50,-10)" ) - assert_equal( arr[0].simple_polygon.inspect, "(10,-10;10,40;50,40;50,-10)" ) + assert_equal( arr[0].polygon.to_s, "(10,-10;10,40;50,40;50,-10)" ) + assert_equal( arr[0].simple_polygon.to_s, "(10,-10;10,40;50,40;50,-10)" ) assert_equal( arr[0].edge.inspect, "nil" ) assert_equal( arr[0].edge_pair.inspect, "nil" ) - assert_equal( arr[0].box.inspect, "(10,-10;50,40)" ) + assert_equal( arr[0].box.to_s, "(10,-10;50,40)" ) assert_equal( arr[0].path.inspect, "nil" ) assert_equal( arr[0].text.inspect, "nil" ) assert_equal( arr[0].is_polygon?, false ) @@ -178,7 +178,7 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_edge?, true ) assert_equal( arr[0].polygon.inspect, "nil" ) assert_equal( arr[0].simple_polygon.inspect, "nil" ) - assert_equal( arr[0].edge.inspect, "(-1,2;5,2)" ) + assert_equal( arr[0].edge.to_s, "(-1,2;5,2)" ) assert_equal( arr[0].edge_pair.inspect, "nil" ) assert_equal( arr[0].box.inspect, "nil" ) assert_equal( arr[0].path.inspect, "nil" ) @@ -204,7 +204,7 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_edge_pair?, true ) assert_equal( arr[0].polygon.inspect, "nil" ) assert_equal( arr[0].simple_polygon.inspect, "nil" ) - assert_equal( arr[0].edge_pair.inspect, "(-1,2;5,2)/(-1,5;5,5)" ) + assert_equal( arr[0].edge_pair.to_s, "(-1,2;5,2)/(-1,5;5,5)" ) assert_equal( arr[0].edge.inspect, "nil" ) assert_equal( arr[0].box.inspect, "nil" ) assert_equal( arr[0].path.inspect, "nil" ) @@ -228,12 +228,12 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_null?, false ) assert_equal( arr[0].type, RBA::Shape::t_path ) assert_equal( arr[0].is_path?, true ) - assert_equal( arr[0].polygon.inspect, "(12,7;-12,13;-2,53;22,47)" ) - assert_equal( arr[0].simple_polygon.inspect, "(12,7;-12,13;-2,53;22,47)" ) + assert_equal( arr[0].polygon.to_s, "(12,7;-12,13;-2,53;22,47)" ) + assert_equal( arr[0].simple_polygon.to_s, "(12,7;-12,13;-2,53;22,47)" ) assert_equal( arr[0].edge.inspect, "nil" ) assert_equal( arr[0].edge_pair.inspect, "nil" ) assert_equal( arr[0].box.inspect, "nil" ) - assert_equal( arr[0].path.inspect, "(0,10;10,50) w=25 bx=0 ex=0 r=false" ) + assert_equal( arr[0].path.to_s, "(0,10;10,50) w=25 bx=0 ex=0 r=false" ) assert_equal( arr[0].text.inspect, "nil" ) assert_equal( arr[0].path == a, true ) assert_equal( arr[0].path_width, 25 ) @@ -264,8 +264,8 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_null?, false ) assert_equal( arr[0].type, RBA::Shape::t_simple_polygon ) assert_equal( arr[0].is_polygon?, true ) - assert_equal( arr[0].polygon.inspect, "(0,1;1,5;5,5)" ) - assert_equal( arr[0].simple_polygon.inspect, "(0,1;1,5;5,5)" ) + assert_equal( arr[0].polygon.to_s, "(0,1;1,5;5,5)" ) + assert_equal( arr[0].simple_polygon.to_s, "(0,1;1,5;5,5)" ) assert_equal( arr[0].edge.inspect, "nil" ) assert_equal( arr[0].edge_pair.inspect, "nil" ) assert_equal( arr[0].box.inspect, "nil" ) @@ -446,11 +446,11 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].has_prop_id?, false ) assert_equal( arr[0].is_null?, false ) assert_equal( arr[0].type, RBA::Shape::t_box ) - assert_equal( arr[0].dpolygon.inspect, "(0.01,-0.01;0.01,0.04;0.05,0.04;0.05,-0.01)" ) - assert_equal( arr[0].dsimple_polygon.inspect, "(0.01,-0.01;0.01,0.04;0.05,0.04;0.05,-0.01)" ) + assert_equal( arr[0].dpolygon.to_s, "(0.01,-0.01;0.01,0.04;0.05,0.04;0.05,-0.01)" ) + assert_equal( arr[0].dsimple_polygon.to_s, "(0.01,-0.01;0.01,0.04;0.05,0.04;0.05,-0.01)" ) assert_equal( arr[0].dedge.inspect, "nil" ) assert_equal( arr[0].dedge_pair.inspect, "nil" ) - assert_equal( arr[0].dbox.inspect, "(0.01,-0.01;0.05,0.04)" ) + assert_equal( arr[0].dbox.to_s, "(0.01,-0.01;0.05,0.04)" ) assert_equal( arr[0].dpath.inspect, "nil" ) assert_equal( arr[0].dtext.inspect, "nil" ) assert_equal( arr[0].is_polygon?, false ) @@ -472,12 +472,12 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_edge?, true ) assert_equal( arr[0].dpolygon.inspect, "nil" ) assert_equal( arr[0].dsimple_polygon.inspect, "nil" ) - assert_equal( arr[0].dedge.inspect, "(-0.001,0.002;0.005,0.002)" ) + assert_equal( arr[0].dedge.to_s, "(-0.001,0.002;0.005,0.002)" ) assert_equal( arr[0].dedge_pair.inspect, "nil" ) assert_equal( arr[0].dbox.inspect, "nil" ) assert_equal( arr[0].dpath.inspect, "nil" ) assert_equal( arr[0].dtext.inspect, "nil" ) - assert_equal( arr[0].dbbox.inspect, "(-0.001,0.002;0.005,0.002)" ) + assert_equal( arr[0].dbbox.to_s, "(-0.001,0.002;0.005,0.002)" ) arr = [] shapes.each( RBA::Shapes::SBoxes ) { |s| arr.push( s ) } assert_equal( arr.size, 1 ) @@ -497,12 +497,12 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_edge_pair?, true ) assert_equal( arr[0].dpolygon.inspect, "nil" ) assert_equal( arr[0].dsimple_polygon.inspect, "nil" ) - assert_equal( arr[0].dedge_pair.inspect, "(-0.001,0.002;0.005,0.002)/(-0.001,0.005;0.005,0.005)" ) + assert_equal( arr[0].dedge_pair.to_s, "(-0.001,0.002;0.005,0.002)/(-0.001,0.005;0.005,0.005)" ) assert_equal( arr[0].dedge.inspect, "nil" ) assert_equal( arr[0].dbox.inspect, "nil" ) assert_equal( arr[0].dpath.inspect, "nil" ) assert_equal( arr[0].dtext.inspect, "nil" ) - assert_equal( arr[0].dbbox.inspect, "(-0.001,0.002;0.005,0.005)" ) + assert_equal( arr[0].dbbox.to_s, "(-0.001,0.002;0.005,0.005)" ) arr = [] shapes.each( RBA::Shapes::SBoxes ) { |s| arr.push( s ) } assert_equal( arr.size, 1 ) @@ -520,12 +520,12 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_null?, false ) assert_equal( arr[0].type, RBA::Shape::t_path ) assert_equal( arr[0].is_path?, true ) - assert_equal( arr[0].dpolygon.inspect, "(0.012,0.007;-0.012,0.013;-0.002,0.053;0.022,0.047)" ) - assert_equal( arr[0].dsimple_polygon.inspect, "(0.012,0.007;-0.012,0.013;-0.002,0.053;0.022,0.047)" ) + assert_equal( arr[0].dpolygon.to_s, "(0.012,0.007;-0.012,0.013;-0.002,0.053;0.022,0.047)" ) + assert_equal( arr[0].dsimple_polygon.to_s, "(0.012,0.007;-0.012,0.013;-0.002,0.053;0.022,0.047)" ) assert_equal( arr[0].dedge.inspect, "nil" ) assert_equal( arr[0].dedge_pair.inspect, "nil" ) assert_equal( arr[0].dbox.inspect, "nil" ) - assert_equal( arr[0].dpath.inspect, "(0,0.01;0.01,0.05) w=0.025 bx=0 ex=0 r=false" ) + assert_equal( arr[0].dpath.to_s, "(0,0.01;0.01,0.05) w=0.025 bx=0 ex=0 r=false" ) assert_equal( arr[0].dtext.inspect, "nil" ) assert_equal( "%.12g" % arr[0].path_dwidth, "0.025" ) assert_equal( "%.12g" % arr[0].dperimeter, "0.132" ) @@ -554,8 +554,8 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].is_null?, false ) assert_equal( arr[0].type, RBA::Shape::t_simple_polygon ) assert_equal( arr[0].is_polygon?, true ) - assert_equal( arr[0].dpolygon.inspect, "(0,0.001;0.001,0.005;0.005,0.005)" ) - assert_equal( arr[0].dsimple_polygon.inspect, "(0,0.001;0.001,0.005;0.005,0.005)" ) + assert_equal( arr[0].dpolygon.to_s, "(0,0.001;0.001,0.005;0.005,0.005)" ) + assert_equal( arr[0].dsimple_polygon.to_s, "(0,0.001;0.001,0.005;0.005,0.005)" ) assert_equal( arr[0].dedge.inspect, "nil" ) assert_equal( arr[0].dedge_pair.inspect, "nil" ) assert_equal( arr[0].dbox.inspect, "nil" ) @@ -587,10 +587,10 @@ class DBShapes_TestClass < TestBase assert_equal( arr[0].type, RBA::Shape::t_polygon ) assert_equal( arr[0].is_polygon?, true ) assert_equal( arr[0].is_simple_polygon?, false ) - assert_equal( arr[0].dpolygon.inspect, "(0,0.001;0.001,0.005;0.005,0.005)" ) - assert_equal( arr[0].dsimple_polygon.inspect, "(0,0.001;0.001,0.005;0.005,0.005)" ) + assert_equal( arr[0].dpolygon.to_s, "(0,0.001;0.001,0.005;0.005,0.005)" ) + assert_equal( arr[0].dsimple_polygon.to_s, "(0,0.001;0.001,0.005;0.005,0.005)" ) assert_equal( arr[0].holes, 0 ) - assert_equal( arr[0].dbbox.inspect, "(0,0.001;0.005,0.005)" ) + assert_equal( arr[0].dbbox.to_s, "(0,0.001;0.005,0.005)" ) parr = [] arr[0].each_dpoint_hull { |p| parr.push( p.to_s ) } assert_equal( parr, ["0,0.001", "0.001,0.005", "0.005,0.005"] ) @@ -844,7 +844,7 @@ class DBShapes_TestClass < TestBase s2.text = RBA::Text::new( "text", RBA::Trans::new( RBA::Point::new( 100, 200 ) ) ) assert_equal(s2.polygon.inspect, "nil") assert_equal(s2.simple_polygon.inspect, "nil") - assert_equal(s2.text.inspect, "('text',r0 100,200)") + assert_equal(s2.text.to_s, "('text',r0 100,200)") assert_equal(s2.edge.inspect, "nil") assert_equal(s2.edge_pair.inspect, "nil") assert_equal(s2.path.inspect, "nil") @@ -1067,7 +1067,7 @@ class DBShapes_TestClass < TestBase s2.text = RBA::DText::new( "text", RBA::DTrans::new( RBA::DPoint::new( 0.100, 0.200 ) ) ) assert_equal(s2.polygon.inspect, "nil") assert_equal(s2.simple_polygon.inspect, "nil") - assert_equal(s2.text.inspect, "('text',r0 100,200)") + assert_equal(s2.text.to_s, "('text',r0 100,200)") assert_equal(s2.edge.inspect, "nil") assert_equal(s2.path.inspect, "nil") assert_equal(s2.box.inspect, "nil") diff --git a/testdata/ruby/layLayers.rb b/testdata/ruby/layLayers.rb index 3aa3597c0..c71e1e586 100644 --- a/testdata/ruby/layLayers.rb +++ b/testdata/ruby/layLayers.rb @@ -152,7 +152,7 @@ class LAYLayers_TestClass < TestBase l12_new.source = "@* (0,0 *0.5) (0,5 r45 *2.5)" cv.set_layer_properties( p12, l12_new ) trans = p12.current.trans( true ) - assert_equal( trans.to_s, p12.current.trans.to_s ) + assert_equal( trans.map(&:to_s), p12.current.trans.map(&:to_s) ) assert_equal( trans.size, 2 ) assert_equal( trans [0].to_s, "r0 *0.5 0,0" ) assert_equal( trans [1].to_s, "r45 *2.5 0,5" ) diff --git a/testdata/ruby/tlTest.rb b/testdata/ruby/tlTest.rb index 183d82a8d..9ebf064e8 100644 --- a/testdata/ruby/tlTest.rb +++ b/testdata/ruby/tlTest.rb @@ -121,7 +121,7 @@ class Tl_TestClass < TestBase expr = RBA::Expression::new("x=a&b; y=x; z=y; [x,y,z]", { "a" => box1, "b" => box2, "x" => nil, "y" => nil, "z" => nil }) res = expr.eval - assert_equal(res.inspect, "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") + assert_equal(res.map(&:to_s), %w((50,150;200,300) (50,150;200,300) (50,150;200,300))) # all objects are individual copies assert_not_equal(res[0].object_id, box1.object_id) @@ -136,7 +136,7 @@ class Tl_TestClass < TestBase expr = RBA::Expression::new("var x=a&b; var y=x; var z=y; [x,y,z]", { "a" => box1, "b" => box2 }) res = expr.eval - assert_equal(res.inspect, "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") + assert_equal(res.map(&:to_s), %w((50,150;200,300) (50,150;200,300) (50,150;200,300))) # all objects are individual copies assert_not_equal(res[0].object_id, box1.object_id) @@ -146,7 +146,7 @@ class Tl_TestClass < TestBase # destruction of the expression's object space does not matter since we have copies expr._destroy - assert_equal(res.inspect, "[(50,150;200,300), (50,150;200,300), (50,150;200,300)]") + assert_equal(res.map(&:to_s), %w((50,150;200,300) (50,150;200,300) (50,150;200,300))) # ------------------------------------------------- @@ -185,7 +185,7 @@ class Tl_TestClass < TestBase expr = RBA::Expression::new("x=a&b; y=x; z=y; [x,y,z]", { "a" => region1, "b" => region2, "x" => nil, "y" => nil, "z" => nil }) res = expr.eval - assert_equal(res.inspect, "[(50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150)]") + assert_equal(res.map(&:to_s), %w((50,150;50,300;200,300;200,150) (50,150;50,300;200,300;200,150) (50,150;50,300;200,300;200,150))) # regions are managed objects -> passing the object through the expression persists it's object ID assert_not_equal(res[0].object_id, region1.object_id) @@ -202,7 +202,7 @@ class Tl_TestClass < TestBase expr = RBA::Expression::new("var x=a&b; var y=x; var z=y; [x,y,z]", { "a" => region1, "b" => region2 }) res = expr.eval - assert_equal(res.inspect, "[(50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150), (50,150;50,300;200,300;200,150)]") + assert_equal(res.map(&:to_s), %w((50,150;50,300;200,300;200,150) (50,150;50,300;200,300;200,150) (50,150;50,300;200,300;200,150))) # regions are managed objects -> passing the object through the expression persists it's object ID assert_not_equal(res[0].object_id, region1.object_id)