From 8151feac56c4cf5dffa46c0c0521a2a48084b97e Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 2 Aug 2025 21:28:48 +0200 Subject: [PATCH] Some debugging, skipping clusters without shapes on primary layer for example --- src/db/db/dbLayoutToNetlist.cc | 8 +++++++- src/db/db/gsiDeclDbEdgePairs.cc | 12 ++++++------ src/db/db/gsiDeclDbEdges.cc | 12 ++++++------ src/db/db/gsiDeclDbLayoutToNetlist.cc | 13 +++++++++++-- src/db/db/gsiDeclDbRegion.cc | 12 ++++++------ src/db/db/gsiDeclDbTexts.cc | 12 ++++++------ testdata/ruby/dbEdgePairsTest.rb | 6 +++--- testdata/ruby/dbEdgesTest.rb | 6 +++--- testdata/ruby/dbRegionTest.rb | 6 +++--- testdata/ruby/dbTextsTest.rb | 6 +++--- 10 files changed, 54 insertions(+), 39 deletions(-) diff --git a/src/db/db/dbLayoutToNetlist.cc b/src/db/db/dbLayoutToNetlist.cc index e8bfccf83..856e889cc 100644 --- a/src/db/db/dbLayoutToNetlist.cc +++ b/src/db/db/dbLayoutToNetlist.cc @@ -2085,6 +2085,7 @@ LayoutToNetlist::measure_net (const db::Region &primary, const std::map (m_net_clusters, primary_layer, *cid, *c).at_end ()) { + continue; + } + eval.reset (*cid, *c); compiled_expr.execute (); if (! eval.skip ()) { db::Shapes &shapes = ly.cell (*cid).shapes (dl.layer ()); - get_merged_shapes_of_net (*cid, *c, layer_of (primary), shapes, db::properties_id (eval.prop_set_out ())); + get_merged_shapes_of_net (*cid, *c, primary_layer, shapes, db::properties_id (eval.prop_set_out ())); } } diff --git a/src/db/db/gsiDeclDbEdgePairs.cc b/src/db/db/gsiDeclDbEdgePairs.cc index 137425533..b5c6c4747 100644 --- a/src/db/db/gsiDeclDbEdgePairs.cc +++ b/src/db/db/gsiDeclDbEdgePairs.cc @@ -90,7 +90,7 @@ static gsi::EdgePairFilterBase *make_pg (const tl::Variant &name, const std::str return new EdgePairPropertiesFilter (name, pattern, inverse); } -static gsi::EdgePairFilterBase *make_pe (const std::string &expression, bool inverse, double dbu, const std::map &variables) +static gsi::EdgePairFilterBase *make_pe (const std::string &expression, bool inverse, const std::map &variables, double dbu) { return new gsi::expression_filter (expression, inverse, dbu, variables); } @@ -136,7 +136,7 @@ Class decl_EdgePairFilterBase ("db", "EdgePairFilterBas "\n" "This feature has been introduced in version 0.30." ) + - gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates an expression-based filter\n" "@param expression The expression to evaluate.\n" "@param inverse If true, inverts the selection - i.e. all edge pairs without a property with the given name and value range are selected.\n" @@ -257,14 +257,14 @@ Class > decl_EdgePairProcessor ( static property_computation_processor * -new_pcp (const db::EdgePairs *container, const std::map &expressions, bool copy_properties, double dbu, const std::map &variables) +new_pcp (const db::EdgePairs *container, const std::map &expressions, bool copy_properties, const std::map &variables, double dbu) { return new property_computation_processor (container, expressions, copy_properties, dbu, variables); } static property_computation_processor * -new_pcps (const db::EdgePairs *container, const std::string &expression, bool copy_properties, double dbu, const std::map &variables) +new_pcps (const db::EdgePairs *container, const std::string &expression, bool copy_properties, const std::map &variables, double dbu) { std::map expressions; expressions.insert (std::make_pair (tl::Variant (), expression)); @@ -273,7 +273,7 @@ new_pcps (const db::EdgePairs *container, const std::string &expression, bool co Class > decl_EdgePairPropertiesExpressions (decl_EdgePairProcessorBase, "db", "EdgePairPropertiesExpressions", property_computation_processor::method_decls (true) + - gsi::constructor ("new", &new_pcp, gsi::arg ("edge_pairs"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("new", &new_pcp, gsi::arg ("edge_pairs"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates a new properties expressions operator\n" "\n" "@param edge_pairs The edge pair collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n" @@ -282,7 +282,7 @@ Class > "@param dbu If not zero, this value specifies the database unit to use. If given, the shapes returned by the 'shape' function will be micrometer-unit objects.\n" "@param variables Arbitrary values that are available as variables inside the expressions.\n" ) + - gsi::constructor ("new", &new_pcps, gsi::arg ("edge_pairs"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("new", &new_pcps, gsi::arg ("edge_pairs"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates a new properties expressions operator\n" "\n" "@param edge_pairs The edge pair collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n" diff --git a/src/db/db/gsiDeclDbEdges.cc b/src/db/db/gsiDeclDbEdges.cc index c928aee06..9a98cfb89 100644 --- a/src/db/db/gsiDeclDbEdges.cc +++ b/src/db/db/gsiDeclDbEdges.cc @@ -91,7 +91,7 @@ static gsi::EdgeFilterBase *make_pg (const tl::Variant &name, const std::string return new EdgePropertiesFilter (name, pattern, inverse); } -static gsi::EdgeFilterBase *make_pe (const std::string &expression, bool inverse, double dbu, const std::map &variables) +static gsi::EdgeFilterBase *make_pe (const std::string &expression, bool inverse, const std::map &variables, double dbu) { return new gsi::expression_filter (expression, inverse, dbu, variables); } @@ -137,7 +137,7 @@ Class decl_EdgeFilterBase ("db", "EdgeFilterBase", "\n" "This feature has been introduced in version 0.30." ) + - gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates an expression-based filter\n" "@param expression The expression to evaluate.\n" "@param inverse If true, inverts the selection - i.e. all edges without a property with the given name and value range are selected.\n" @@ -262,14 +262,14 @@ Class > decl_EdgeOperator (decl_Edge static property_computation_processor * -new_pcp (const db::Edges *container, const std::map &expressions, bool copy_properties, double dbu, const std::map &variables) +new_pcp (const db::Edges *container, const std::map &expressions, bool copy_properties, const std::map &variables, double dbu) { return new property_computation_processor (container, expressions, copy_properties, dbu, variables); } static property_computation_processor * -new_pcps (const db::Edges *container, const std::string &expression, bool copy_properties, double dbu, const std::map &variables) +new_pcps (const db::Edges *container, const std::string &expression, bool copy_properties, const std::map &variables, double dbu) { std::map expressions; expressions.insert (std::make_pair (tl::Variant (), expression)); @@ -278,7 +278,7 @@ new_pcps (const db::Edges *container, const std::string &expression, bool copy_p Class > decl_EdgePropertiesExpressions (decl_EdgeProcessorBase, "db", "EdgePropertiesExpressions", property_computation_processor::method_decls (true) + - gsi::constructor ("new", &new_pcp, gsi::arg ("edges"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("new", &new_pcp, gsi::arg ("edges"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates a new properties expressions operator\n" "\n" "@param edges The edge collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n" @@ -287,7 +287,7 @@ Class > decl_Ed "@param dbu If not zero, this value specifies the database unit to use. If given, the shapes returned by the 'shape' function will be micrometer-unit objects.\n" "@param variables Arbitrary values that are available as variables inside the expressions.\n" ) + - gsi::constructor ("new", &new_pcps, gsi::arg ("edges"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("new", &new_pcps, gsi::arg ("edges"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates a new properties expressions operator\n" "\n" "@param edges The edge collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n" diff --git a/src/db/db/gsiDeclDbLayoutToNetlist.cc b/src/db/db/gsiDeclDbLayoutToNetlist.cc index 6158e16d4..0625fbc9b 100644 --- a/src/db/db/gsiDeclDbLayoutToNetlist.cc +++ b/src/db/db/gsiDeclDbLayoutToNetlist.cc @@ -216,9 +216,18 @@ static db::Region antenna_check (db::LayoutToNetlist *l2n, const db::Region &pol return antenna_check3 (l2n, poly, 1, 0, metal, 1, 0, ratio, diodes, texts); } -static db::Region measure_net (db::LayoutToNetlist *l2n, const db::Region &primary, const std::map &secondary, const std::string &expression, const std::map &variables) +static db::Region measure_net (db::LayoutToNetlist *l2n, const db::Region &primary, const std::map &secondary, const std::string &expression, const tl::Variant &variables) { - return l2n->measure_net (primary, secondary, expression, variables); + if (! variables.is_array ()) { + throw tl::Exception (tl::to_string (tr ("'variables' argument needs to a hash"))); + } + + std::map variables_map; + for (auto v = variables.begin_array (); v != variables.end_array (); ++v) { + variables_map [v->first.to_string ()] = v->second; + } + + return l2n->measure_net (primary, secondary, expression, variables_map); } static void join_net_names (db::LayoutToNetlist *l2n, const std::string &s) diff --git a/src/db/db/gsiDeclDbRegion.cc b/src/db/db/gsiDeclDbRegion.cc index 2eb4604e9..496e6fd02 100644 --- a/src/db/db/gsiDeclDbRegion.cc +++ b/src/db/db/gsiDeclDbRegion.cc @@ -109,7 +109,7 @@ static gsi::PolygonFilterBase *make_pg (const tl::Variant &name, const std::stri return new PolygonPropertiesFilter (name, pattern, inverse); } -static gsi::PolygonFilterBase *make_pe (const std::string &expression, bool inverse, double dbu, const std::map &variables) +static gsi::PolygonFilterBase *make_pe (const std::string &expression, bool inverse, const std::map &variables, double dbu) { return new gsi::expression_filter (expression, inverse, dbu, variables); } @@ -155,7 +155,7 @@ Class decl_PolygonFilterBase ("db", "PolygonFilterBase", "\n" "This feature has been introduced in version 0.30." ) + - gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates an expression-based filter\n" "@param expression The expression to evaluate.\n" "@param inverse If true, inverts the selection - i.e. all polygons without a property with the given name and value range are selected.\n" @@ -278,13 +278,13 @@ Class > decl_PolygonOperator (dec static property_computation_processor * -new_pcp (const db::Region *container, const std::map &expressions, bool copy_properties, double dbu, const std::map &variables) +new_pcp (const db::Region *container, const std::map &expressions, bool copy_properties, const std::map &variables, double dbu) { return new property_computation_processor (container, expressions, copy_properties, dbu, variables); } property_computation_processor * -new_pcps (const db::Region *container, const std::string &expression, bool copy_properties, double dbu, const std::map &variables) +new_pcps (const db::Region *container, const std::string &expression, bool copy_properties, const std::map &variables, double dbu) { std::map expressions; expressions.insert (std::make_pair (tl::Variant (), expression)); @@ -293,7 +293,7 @@ new_pcps (const db::Region *container, const std::string &expression, bool copy_ Class > decl_PolygonPropertiesExpressions (decl_PolygonProcessorBase, "db", "PolygonPropertiesExpressions", property_computation_processor::method_decls (true) + - gsi::constructor ("new", &new_pcp, gsi::arg ("region"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("new", &new_pcp, gsi::arg ("region"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates a new properties expressions operator\n" "\n" "@param region The region, the processor will be used on. Can be nil, but if given, allows some optimization.\n" @@ -302,7 +302,7 @@ Class > dec "@param dbu If not zero, this value specifies the database unit to use. If given, the shapes returned by the 'shape' function will be micrometer-unit objects.\n" "@param variables Arbitrary values that are available as variables inside the expressions.\n" ) + - gsi::constructor ("new", &new_pcps, gsi::arg ("region"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("new", &new_pcps, gsi::arg ("region"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates a new properties expressions operator\n" "\n" "@param region The region, the processor will be used on. Can be nil, but if given, allows some optimization.\n" diff --git a/src/db/db/gsiDeclDbTexts.cc b/src/db/db/gsiDeclDbTexts.cc index 42304eafc..8cb899b5a 100644 --- a/src/db/db/gsiDeclDbTexts.cc +++ b/src/db/db/gsiDeclDbTexts.cc @@ -87,7 +87,7 @@ static gsi::TextFilterBase *make_pg (const tl::Variant &name, const std::string return new TextPropertiesFilter (name, pattern, inverse); } -static gsi::TextFilterBase *make_pe (const std::string &expression, bool inverse, double dbu, const std::map &variables) +static gsi::TextFilterBase *make_pe (const std::string &expression, bool inverse, const std::map &variables, double dbu) { return new gsi::expression_filter (expression, inverse, dbu, variables); } @@ -133,7 +133,7 @@ Class decl_TextFilterBase ("db", "TextFilterBase", "\n" "This feature has been introduced in version 0.30." ) + - gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("expression_filter", &make_pe, gsi::arg ("expression"), gsi::arg ("inverse", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates an expression-based filter\n" "@param expression The expression to evaluate.\n" "@param inverse If true, inverts the selection - i.e. all texts without a property with the given name and value range are selected.\n" @@ -257,13 +257,13 @@ Class > decl_TextProcessor (decl_Tex static property_computation_processor * -new_pcp (const db::Texts *container, const std::map &expressions, bool copy_properties, double dbu, const std::map &variables) +new_pcp (const db::Texts *container, const std::map &expressions, bool copy_properties, const std::map &variables, double dbu) { return new property_computation_processor (container, expressions, copy_properties, dbu, variables); } property_computation_processor * -new_pcps (const db::Texts *container, const std::string &expression, bool copy_properties, double dbu, const std::map &variables) +new_pcps (const db::Texts *container, const std::string &expression, bool copy_properties, const std::map &variables, double dbu) { std::map expressions; expressions.insert (std::make_pair (tl::Variant (), expression)); @@ -272,7 +272,7 @@ new_pcps (const db::Texts *container, const std::string &expression, bool copy_p Class > decl_TextPropertiesExpressions (decl_TextProcessorBase, "db", "TextPropertiesExpressions", property_computation_processor::method_decls (true) + - gsi::constructor ("new", &new_pcp, gsi::arg ("texts"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("new", &new_pcp, gsi::arg ("texts"), gsi::arg ("expressions"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates a new properties expressions operator\n" "\n" "@param texts The text collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n" @@ -281,7 +281,7 @@ Class > decl_Te "@param dbu If not zero, this value specifies the database unit to use. If given, the shapes returned by the 'shape' function will be micrometer-unit objects.\n" "@param variables Arbitrary values that are available as variables inside the expressions.\n" ) + - gsi::constructor ("new", &new_pcps, gsi::arg ("texts"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("dbu", 0.0), gsi::arg ("variables", std::map (), "{}"), + gsi::constructor ("new", &new_pcps, gsi::arg ("texts"), gsi::arg ("expression"), gsi::arg ("copy_properties", false), gsi::arg ("variables", std::map (), "{}"), gsi::arg ("dbu", 0.0), "@brief Creates a new properties expressions operator\n" "\n" "@param texts The text collection, the processor will be used on. Can be nil, but if given, allows some optimization.\n" diff --git a/testdata/ruby/dbEdgePairsTest.rb b/testdata/ruby/dbEdgePairsTest.rb index c97fadcb3..fa33c0ea3 100644 --- a/testdata/ruby/dbEdgePairsTest.rb +++ b/testdata/ruby/dbEdgePairsTest.rb @@ -704,11 +704,11 @@ class DBEdgePairs_TestClass < TestBase assert_equal(r.to_s, "(0,0;1000,2000)/(-100,200;900,2200){1=>42,PropA=>17}") # replace - pr = RBA::EdgePairPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.distance", "Z" => "value(1)+1" }) + pr = RBA::EdgePairPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.distance", "Z" => "value(1)+one" }, variables: { "one" => 1 }) assert_equal(r.processed(pr).to_s, "(0,0;1000,2000)/(-100,200;900,2200){X=>18,Y=>179,Z=>43}") # replace (with 'put') - pr = RBA::EdgePairPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.distance); put('Z', value(1)+1)") + pr = RBA::EdgePairPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.distance); put('Z', value(1)+one)", variables: { "one" => 1 }) assert_equal(r.processed(pr).to_s, "(0,0;1000,2000)/(-100,200;900,2200){X=>18,Y=>179,Z=>43}") # substitutions @@ -722,7 +722,7 @@ class DBEdgePairs_TestClass < TestBase ef = RBA::EdgePairFilterBase::expression_filter("PropX==18") assert_equal(r.filtered(ef).to_s, "") - ef = RBA::EdgePairFilterBase::expression_filter("PropA==17") + ef = RBA::EdgePairFilterBase::expression_filter("PropA==v17", variables: { "v17" => 17 }) assert_equal(r.filtered(ef).to_s, "(0,0;1000,2000)/(-100,200;900,2200){1=>42,PropA=>17}") ef = RBA::EdgePairFilterBase::expression_filter("value(1)>=40") diff --git a/testdata/ruby/dbEdgesTest.rb b/testdata/ruby/dbEdgesTest.rb index c12de712f..49ed1a196 100644 --- a/testdata/ruby/dbEdgesTest.rb +++ b/testdata/ruby/dbEdgesTest.rb @@ -1112,11 +1112,11 @@ class DBEdges_TestClass < TestBase assert_equal(r.to_s, "(0,0;1000,2000){1=>42,PropA=>17}") # replace - pr = RBA::EdgePropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.length", "Z" => "value(1)+1" }) + pr = RBA::EdgePropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.length", "Z" => "value(1)+one" }, variables: { "one" => 1 }) assert_equal(r.processed(pr).to_s, "(0,0;1000,2000){X=>18,Y=>2236,Z=>43}") # replace (with 'put') - pr = RBA::EdgePropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.length); put('Z', value(1)+1)") + pr = RBA::EdgePropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.length); put('Z', value(1)+one)", variables: { "one" => 1 }) assert_equal(r.processed(pr).to_s, "(0,0;1000,2000){X=>18,Y=>2236,Z=>43}") # substitutions @@ -1130,7 +1130,7 @@ class DBEdges_TestClass < TestBase ef = RBA::EdgeFilterBase::expression_filter("PropX==18") assert_equal(r.filtered(ef).to_s, "") - ef = RBA::EdgeFilterBase::expression_filter("PropA==17") + ef = RBA::EdgeFilterBase::expression_filter("PropA==v17", variables: { "v17" => 17 }) assert_equal(r.filtered(ef).to_s, "(0,0;1000,2000){1=>42,PropA=>17}") ef = RBA::EdgeFilterBase::expression_filter("value(1)>=40") diff --git a/testdata/ruby/dbRegionTest.rb b/testdata/ruby/dbRegionTest.rb index c7ec7d28e..e9324d065 100644 --- a/testdata/ruby/dbRegionTest.rb +++ b/testdata/ruby/dbRegionTest.rb @@ -1730,11 +1730,11 @@ class DBRegion_TestClass < TestBase assert_equal(r.to_s, "(0,0;0,2000;1000,2000;1000,0){1=>42,PropA=>17}") # replace - pr = RBA::PolygonPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.area", "Z" => "value(1)+1" }) + pr = RBA::PolygonPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.area", "Z" => "value(1)+one" }, variables: { "one" => 1 }) assert_equal(r.processed(pr).to_s, "(0,0;0,2000;1000,2000;1000,0){X=>18,Y=>2000000,Z=>43}") # replace (with 'put') - pr = RBA::PolygonPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.area); put('Z', value(1)+1)") + pr = RBA::PolygonPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.area); put('Z', value(1)+one)", variables: { "one" => 1 }) assert_equal(r.processed(pr).to_s, "(0,0;0,2000;1000,2000;1000,0){X=>18,Y=>2000000,Z=>43}") # substitutions @@ -1748,7 +1748,7 @@ class DBRegion_TestClass < TestBase ef = RBA::PolygonFilterBase::expression_filter("PropX==18") assert_equal(r.filtered(ef).to_s, "") - ef = RBA::PolygonFilterBase::expression_filter("PropA==17") + ef = RBA::PolygonFilterBase::expression_filter("PropA==v17", variables: { "v17" => 17 }) assert_equal(r.filtered(ef).to_s, "(0,0;0,2000;1000,2000;1000,0){1=>42,PropA=>17}") ef = RBA::PolygonFilterBase::expression_filter("value(1)>=40") diff --git a/testdata/ruby/dbTextsTest.rb b/testdata/ruby/dbTextsTest.rb index 098039284..792ee25fa 100644 --- a/testdata/ruby/dbTextsTest.rb +++ b/testdata/ruby/dbTextsTest.rb @@ -554,11 +554,11 @@ class DBTexts_TestClass < TestBase assert_equal(r.to_s, "('T',r0 100,200){1=>42,PropA=>17}") # replace - pr = RBA::TextPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.bbox.center.x", "Z" => "value(1)+1" }) + pr = RBA::TextPropertiesExpressions::new(r, { "X" => "PropA+1", "Y" => "shape.bbox.center.x", "Z" => "value(1)+one" }, variables: { "one" => 1 }) assert_equal(r.processed(pr).to_s, "('T',r0 100,200){X=>18,Y=>100,Z=>43}") # replace (with 'put') - pr = RBA::TextPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.bbox.center.x); put('Z', value(1)+1)") + pr = RBA::TextPropertiesExpressions::new(r, "put('X', PropA+1); put('Y', shape.bbox.center.x); put('Z', value(1)+one)", variables: { "one" => 1 }) assert_equal(r.processed(pr).to_s, "('T',r0 100,200){X=>18,Y=>100,Z=>43}") # substitutions @@ -572,7 +572,7 @@ class DBTexts_TestClass < TestBase ef = RBA::TextFilterBase::expression_filter("PropX==18") assert_equal(r.filtered(ef).to_s, "") - ef = RBA::TextFilterBase::expression_filter("PropA==17") + ef = RBA::TextFilterBase::expression_filter("PropA==v17", variables: { "v17" => 17 }) assert_equal(r.filtered(ef).to_s, "('T',r0 100,200){1=>42,PropA=>17}") ef = RBA::TextFilterBase::expression_filter("value(1)>=40")