mirror of https://github.com/KLayout/klayout.git
Fixed unit tests
This commit is contained in:
parent
f7c7e8b0be
commit
2bc8ac235a
|
|
@ -38,7 +38,7 @@ public:
|
|||
pex::RNode::node_type type () const { return checked_pointer ()->type; }
|
||||
db::DBox location () const { return checked_pointer ()->location; }
|
||||
unsigned int port_index () const { return checked_pointer ()->port_index; }
|
||||
std::string to_string () const { return checked_pointer ()->to_string (); }
|
||||
std::string to_string (bool with_coords = false) const { return checked_pointer ()->to_string (with_coords); }
|
||||
|
||||
size_t obj_id () const
|
||||
{
|
||||
|
|
@ -89,7 +89,7 @@ public:
|
|||
RNode *a () const { return RNode::make_node_object (checked_pointer ()->a ()); }
|
||||
RNode *b () const { return RNode::make_node_object (checked_pointer ()->b ()); }
|
||||
|
||||
std::string to_string () const { return checked_pointer ()->to_string (); }
|
||||
std::string to_string (bool with_coords = false) const { return checked_pointer ()->to_string (with_coords); }
|
||||
|
||||
size_t obj_id () const
|
||||
{
|
||||
|
|
@ -193,8 +193,9 @@ Class<RNode> decl_RNode ("pex", "RNode",
|
|||
"ones may represent the same internal object. The 'object_id' is a ID that "
|
||||
"indicates the internal object. Same object_id means same node."
|
||||
) +
|
||||
gsi::method ("to_s", &RNode::to_string,
|
||||
gsi::method ("to_s", &RNode::to_string, gsi::arg ("with_coords", false),
|
||||
"@brief Returns a string representation of this object\n"
|
||||
"Nodes are printed with coordinates with 'with_coords' is true."
|
||||
) +
|
||||
gsi::iterator_ext ("each_element", gsi::return_new_object (), &begin_node_elements, &end_network_elements,
|
||||
"@brief Iterates the \\RElement objects attached to the node\n"
|
||||
|
|
@ -226,8 +227,9 @@ Class<RElement> decl_RElement ("pex", "RElement",
|
|||
"ones may represent the same internal object. The 'object_id' is a ID that "
|
||||
"indicates the internal object. Same object_id means same element."
|
||||
) +
|
||||
gsi::method ("to_s", &RElement::to_string,
|
||||
gsi::method ("to_s", &RElement::to_string, gsi::arg ("with_coords", false),
|
||||
"@brief Returns a string representation of this object\n"
|
||||
"Nodes are printed with coordinates with 'with_coords' is true."
|
||||
) +
|
||||
gsi::method ("resistance", &RElement::resistance,
|
||||
"@brief Gets the resistance value of the object\n"
|
||||
|
|
@ -387,8 +389,9 @@ Class<pex::RNetwork> decl_RNetwork ("pex", "RNetwork",
|
|||
gsi::method ("num_elements", &pex::RNetwork::num_elements,
|
||||
"@brief Gets the number of elements in the network\n"
|
||||
) +
|
||||
gsi::method ("to_s", &pex::RNetwork::to_string,
|
||||
gsi::method ("to_s", &pex::RNetwork::to_string, gsi::arg ("with_coords", false),
|
||||
"@brief Returns a string representation of the network\n"
|
||||
"Nodes are printed with coordinates with 'with_coords' is true."
|
||||
),
|
||||
"@brief Represents a network of resistors\n"
|
||||
"\n"
|
||||
|
|
|
|||
|
|
@ -994,15 +994,15 @@ class DBPolygon_TestClass < TestBase
|
|||
assert_equal(p.delaunay(0.0, 0.5).to_s, "(0,0;0,100;250,0);(250,0;500,100;500,0);(250,0;0,100;500,100);(750,0;1000,100;1000,0);(500,0;500,100;750,0);(750,0;500,100;1000,100)")
|
||||
assert_equal(p.delaunay(20000, 0.0).to_s, "(0,0;250,50;500,0);(500,0;250,50;500,100);(250,50;0,100;500,100);(0,0;0,100;250,50);(500,0;500,100;750,50);(500,0;750,50;1000,0);(1000,0;750,50;1000,100);(750,50;500,100;1000,100)")
|
||||
|
||||
assert_equal(p.delaunay([ RBA::Point::new(50, 50) ]).to_s, "(0,0;0,100;50,50);(50,50;0,100;1000,100);(0,0;50,50;1000,0);(1000,0;50,50;1000,100)")
|
||||
assert_equal(p.delaunay([ RBA::Point::new(50, 50) ]).to_s, "(0,0;0,100;50,50);(50,50;0,100;1000,100);(1000,0;50,50;1000,100);(0,0;50,50;1000,0)")
|
||||
|
||||
p = RBA::DPolygon::new(RBA::DBox::new(0, 0, 1000, 100))
|
||||
assert_equal(p.delaunay.collect(&:to_s).join(";"), "(0,0;0,100;1000,100);(0,0;1000,100;1000,0)")
|
||||
assert_equal(p.delaunay.each.collect(&:to_s).join(";"), "(0,0;0,100;1000,100);(0,0;1000,100;1000,0)")
|
||||
|
||||
assert_equal(p.delaunay(0.0, 0.5).collect(&:to_s).join(";"), "(0,0;0,100;250,0);(250,0;500,100;500,0);(250,0;0,100;500,100);(750,0;1000,100;1000,0);(500,0;500,100;750,0);(750,0;500,100;1000,100)")
|
||||
assert_equal(p.delaunay(20000, 0.0).collect(&:to_s).join(";"), "(0,0;250,50;500,0);(500,0;250,50;500,100);(250,50;0,100;500,100);(0,0;0,100;250,50);(500,0;500,100;750,50);(500,0;750,50;1000,0);(1000,0;750,50;1000,100);(750,50;500,100;1000,100)")
|
||||
|
||||
assert_equal(p.delaunay([ RBA::DPoint::new(50, 50) ]).collect(&:to_s).join(";"), "(0,0;0,100;50,50);(50,50;0,100;1000,100);(0,0;50,50;1000,0);(1000,0;50,50;1000,100)")
|
||||
assert_equal(p.delaunay([ RBA::DPoint::new(50, 50) ]).collect(&:to_s).join(";"), "(0,0;0,100;50,50);(50,50;0,100;1000,100);(1000,0;50,50;1000,100);(0,0;50,50;1000,0)")
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -426,15 +426,15 @@ class DBSimplePolygon_TestClass < TestBase
|
|||
assert_equal(p.delaunay(0.0, 0.5).to_s, "(0,0;0,100;250,0);(250,0;500,100;500,0);(250,0;0,100;500,100);(750,0;1000,100;1000,0);(500,0;500,100;750,0);(750,0;500,100;1000,100)")
|
||||
assert_equal(p.delaunay(20000, 0.0).to_s, "(0,0;250,50;500,0);(500,0;250,50;500,100);(250,50;0,100;500,100);(0,0;0,100;250,50);(500,0;500,100;750,50);(500,0;750,50;1000,0);(1000,0;750,50;1000,100);(750,50;500,100;1000,100)")
|
||||
|
||||
assert_equal(p.delaunay([ RBA::Point::new(50, 50) ]).to_s, "(0,0;0,100;50,50);(50,50;0,100;1000,100);(0,0;50,50;1000,0);(1000,0;50,50;1000,100)")
|
||||
assert_equal(p.delaunay([ RBA::Point::new(50, 50) ]).to_s, "(0,0;0,100;50,50);(50,50;0,100;1000,100);(1000,0;50,50;1000,100);(0,0;50,50;1000,0)")
|
||||
|
||||
p = RBA::DSimplePolygon::new(RBA::DBox::new(0, 0, 1000, 100))
|
||||
assert_equal(p.delaunay.collect(&:to_s).join(";"), "(0,0;0,100;1000,100);(0,0;1000,100;1000,0)")
|
||||
assert_equal(p.delaunay(20000, 0.0).each.collect(&:to_s).join(";"), "(0,0;250,50;500,0) props={};(500,0;250,50;500,100) props={};(250,50;0,100;500,100) props={};(0,0;0,100;250,50) props={};(500,0;500,100;750,50) props={};(500,0;750,50;1000,0) props={};(1000,0;750,50;1000,100) props={};(750,50;500,100;1000,100) props={}")
|
||||
assert_equal(p.delaunay.each.collect(&:to_s).join(";"), "(0,0;0,100;1000,100) props={};(0,0;1000,100;1000,0) props={}")
|
||||
|
||||
assert_equal(p.delaunay(0.0, 0.5).collect(&:to_s).join(";"), "(0,0;0,100;250,0);(250,0;500,100;500,0);(250,0;0,100;500,100);(750,0;1000,100;1000,0);(500,0;500,100;750,0);(750,0;500,100;1000,100)")
|
||||
assert_equal(p.delaunay(20000, 0.0).collect(&:to_s).join(";"), "(0,0;250,50;500,0);(500,0;250,50;500,100);(250,50;0,100;500,100);(0,0;0,100;250,50);(500,0;500,100;750,50);(500,0;750,50;1000,0);(1000,0;750,50;1000,100);(750,50;500,100;1000,100)")
|
||||
assert_equal(p.delaunay(0.0, 0.5).each.collect(&:to_s).join(";"), "(0,0;0,100;250,0) props={};(250,0;500,100;500,0) props={};(250,0;0,100;500,100) props={};(750,0;1000,100;1000,0) props={};(500,0;500,100;750,0) props={};(750,0;500,100;1000,100) props={}")
|
||||
assert_equal(p.delaunay(20000, 0.0).each.collect(&:to_s).join(";"), "(0,0;250,50;500,0) props={};(500,0;250,50;500,100) props={};(250,50;0,100;500,100) props={};(0,0;0,100;250,50) props={};(500,0;500,100;750,50) props={};(500,0;750,50;1000,0) props={};(1000,0;750,50;1000,100) props={};(750,50;500,100;1000,100) props={}")
|
||||
|
||||
assert_equal(p.delaunay([ RBA::DPoint::new(50, 50) ]).collect(&:to_s).join(";"), "(0,0;0,100;50,50);(50,50;0,100;1000,100);(0,0;50,50;1000,0);(1000,0;50,50;1000,100)")
|
||||
assert_equal(p.delaunay([ RBA::DPoint::new(50, 50) ]).each.collect(&:to_s).join(";"), "(0,0;0,100;50,50) props={};(50,50;0,100;1000,100) props={};(1000,0;50,50;1000,100) props={};(0,0;50,50;1000,0) props={}")
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue