More robustness against differences on different platforms.

This commit is contained in:
Matthias Koefferlein 2021-01-19 20:36:25 +01:00
parent 11e9f89fc2
commit 73485a5061
3 changed files with 73 additions and 17 deletions

View File

@ -580,13 +580,14 @@ TEST(15d)
r.insert (db::Box (db::Point (600, 200), db::Point (700, 300))); r.insert (db::Box (db::Point (600, 200), db::Point (700, 300)));
r.insert (db::Box (db::Point (0, 140), db::Point (350, 160))); r.insert (db::Box (db::Point (0, 140), db::Point (350, 160)));
EXPECT_EQ (r.space_check (120, db::RegionCheckOptions (false, db::Projection)).to_string (), EXPECT_EQ (db::compare(r.space_check (120, db::RegionCheckOptions (false, db::Projection)),
"(0,100;100,100)|(100,140;0,140);" "(0,100;100,100)|(100,140;0,140);"
"(300,160;350,160)|(350,200;300,200);" "(300,160;350,160)|(350,200;300,200);"
"(300,100;350,100)|(350,140;300,140);" "(300,100;350,100)|(350,140;300,140);"
"(300,100;400,100)|(400,200;300,200);" "(300,100;400,100)|(400,200;300,200);"
"(0,160;100,160)|(100,200;0,200);" "(0,160;100,160)|(100,200;0,200);"
"(600,100;700,100)|(700,200;600,200)" "(600,100;700,100)|(700,200;600,200)"
), true
); );
} }
@ -682,17 +683,18 @@ TEST(15h)
db::RegionCheckOptions options; db::RegionCheckOptions options;
options.shielded = false; // does NOT disable internal shielding for "opposite" options.shielded = false; // does NOT disable internal shielding for "opposite"
options.metrics = db::Projection; options.metrics = db::Projection;
options.opposite_filter = db::NoOppositeFilter; options.opposite_filter = db::NoOppositeFilter;
EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), EXPECT_EQ (db::compare(r1.separation_check (r2, 40, options),
"(200,300;200,200)/(210,200;210,300);(100,200;100,300)/(90,300;90,200);(200,100;200,0)/(210,0;210,100);(100,0;100,100)/(90,100;90,0)"); "(200,300;200,200)/(210,200;210,300);(100,200;100,300)/(90,300;90,200);(200,100;200,0)/(210,0;210,100);(100,0;100,100)/(90,100;90,0)"), true);
options.opposite_filter = db::NotOpposite; options.opposite_filter = db::NotOpposite;
EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), EXPECT_EQ (db::compare(r1.separation_check (r2, 40, options),
"(100,200;100,300)/(90,300;90,200);(200,300;200,200)/(210,200;210,300)"); "(100,200;100,300)/(90,300;90,200);(200,300;200,200)/(210,200;210,300)"), true);
options.opposite_filter = db::OnlyOpposite; options.opposite_filter = db::OnlyOpposite;
EXPECT_EQ (r1.separation_check (r2, 40, options).to_string (), EXPECT_EQ (db::compare (r1.separation_check (r2, 40, options),
"(100,0;100,100)/(90,100;90,0);(200,100;200,0)/(210,0;210,100)"); "(100,0;100,100)/(90,100;90,0);(200,100;200,0)/(210,0;210,100)"), true);
} }
TEST(15i) TEST(15i)

View File

@ -1,6 +1,13 @@
# Interact with count # Interact with count
has_unbounded_range = false
begin
r = eval("..2")
has_unbounded_range = true
rescue => ex
end
source($drc_test_source, "TOP") source($drc_test_source, "TOP")
target($drc_test_target) target($drc_test_target)
@ -13,13 +20,21 @@ l2.output(2, 0)
l1.interacting(l2, 1).output(100, 0) l1.interacting(l2, 1).output(100, 0)
l1.interacting(l2, 2).output(101, 0) l1.interacting(l2, 2).output(101, 0)
l1.interacting(l2, 1..2).output(102, 0) l1.interacting(l2, 1..2).output(102, 0)
l1.interacting(l2, 2..).output(103, 0) if has_unbounded_range
l1.interacting(l2, 2..).output(103, 0)
else
l1.interacting(l2, 2..10000).output(103, 0)
end
l1.interacting(l2, 1, 2).output(104, 0) l1.interacting(l2, 1, 2).output(104, 0)
l1.overlapping(l2, 1).output(110, 0) l1.overlapping(l2, 1).output(110, 0)
l1.overlapping(l2, 2).output(111, 0) l1.overlapping(l2, 2).output(111, 0)
l1.overlapping(l2, 1..2).output(112, 0) l1.overlapping(l2, 1..2).output(112, 0)
l1.overlapping(l2, 2..).output(113, 0) if has_unbounded_range
l1.overlapping(l2, 2..).output(113, 0)
else
l1.overlapping(l2, 2..10000).output(113, 0)
end
l1.overlapping(l2, 1, 2).output(114, 0) l1.overlapping(l2, 1, 2).output(114, 0)
l = l1.dup l = l1.dup
@ -32,7 +47,11 @@ l = l1.dup
l.select_interacting(l2, 1..2) l.select_interacting(l2, 1..2)
l.output(202, 0) l.output(202, 0)
l = l1.dup l = l1.dup
l.select_interacting(l2, 2..) if has_unbounded_range
l.select_interacting(l2, 2..)
else
l.select_interacting(l2, 2..10000)
end
l.output(203, 0) l.output(203, 0)
l = l1.dup l = l1.dup
l.select_interacting(l2, 1, 2) l.select_interacting(l2, 1, 2)
@ -48,7 +67,11 @@ l = l1.dup
l.select_overlapping(l2, 1..2) l.select_overlapping(l2, 1..2)
l.output(212, 0) l.output(212, 0)
l = l1.dup l = l1.dup
l.select_overlapping(l2, 2..) if has_unbounded_range
l.select_overlapping(l2, 2..)
else
l.select_overlapping(l2, 2..10000)
end
l.output(213, 0) l.output(213, 0)
l = l1.dup l = l1.dup
l.select_overlapping(l2, 1, 2) l.select_overlapping(l2, 1, 2)
@ -57,7 +80,11 @@ l.output(214, 0)
l1.not_interacting(l2, 1).output(300, 0) l1.not_interacting(l2, 1).output(300, 0)
l1.not_interacting(l2, 2).output(301, 0) l1.not_interacting(l2, 2).output(301, 0)
l1.not_interacting(l2, 1..2).output(302, 0) l1.not_interacting(l2, 1..2).output(302, 0)
l1.not_interacting(l2, 2..).output(303, 0) if has_unbounded_range
l1.not_interacting(l2, 2..).output(303, 0)
else
l1.not_interacting(l2, 2..10000).output(303, 0)
end
l1.not_interacting(l2, 1, 2).output(304, 0) l1.not_interacting(l2, 1, 2).output(304, 0)
l1.not_overlapping(l2, 1).output(310, 0) l1.not_overlapping(l2, 1).output(310, 0)
@ -76,7 +103,11 @@ l = l1.dup
l.select_not_interacting(l2, 1..2) l.select_not_interacting(l2, 1..2)
l.output(402, 0) l.output(402, 0)
l = l1.dup l = l1.dup
l.select_not_interacting(l2, 2..) if has_unbounded_range
l.select_not_interacting(l2, 2..)
else
l.select_not_interacting(l2, 2..10000)
end
l.output(403, 0) l.output(403, 0)
l = l1.dup l = l1.dup
l.select_not_interacting(l2, 1, 2) l.select_not_interacting(l2, 1, 2)
@ -92,7 +123,11 @@ l = l1.dup
l.select_not_overlapping(l2, 1..2) l.select_not_overlapping(l2, 1..2)
l.output(412, 0) l.output(412, 0)
l = l1.dup l = l1.dup
l.select_not_overlapping(l2, 2..) if has_unbounded_range
l.select_not_overlapping(l2, 2..)
else
l.select_not_overlapping(l2, 2..10000)
end
l.output(413, 0) l.output(413, 0)
l = l1.dup l = l1.dup
l.select_not_overlapping(l2, 1, 2) l.select_not_overlapping(l2, 1, 2)

View File

@ -1,4 +1,11 @@
has_unbounded_range = false
begin
r = eval("..2")
has_unbounded_range = true
rescue => ex
end
source $drc_test_source source $drc_test_source
target $drc_test_target target $drc_test_target
@ -17,7 +24,11 @@ l3.output(3, 0)
ar = 4.0/3.0 # "L" shape ar = 4.0/3.0 # "L" shape
l1.with_area_ratio(ar).output(100, 0) l1.with_area_ratio(ar).output(100, 0)
l1.without_area_ratio(ar).output(101, 0) l1.without_area_ratio(ar).output(101, 0)
l1.with_area_ratio(ar+1e-6..).output(102, 0) if has_unbounded_range
l1.with_area_ratio(ar+1e-6..).output(102, 0)
else
l1.with_area_ratio(ar+1e-6..10000).output(102, 0)
end
l1.with_area_ratio(0.0, ar-1e-6).output(103, 0) l1.with_area_ratio(0.0, ar-1e-6).output(103, 0)
l1.squares.output(110, 0) l1.squares.output(110, 0)
@ -25,12 +36,20 @@ l1.non_squares.output(111, 0)
l2.with_bbox_aspect_ratio(2).output(120, 0) l2.with_bbox_aspect_ratio(2).output(120, 0)
l2.with_bbox_aspect_ratio(1).output(121, 0) l2.with_bbox_aspect_ratio(1).output(121, 0)
l2.with_bbox_aspect_ratio(..1).output(122, 0) if has_unbounded_range
l2.with_bbox_aspect_ratio(..1).output(122, 0)
else
l2.with_bbox_aspect_ratio(0..1).output(122, 0)
end
l2.without_bbox_aspect_ratio(0..2).output(123, 0) l2.without_bbox_aspect_ratio(0..2).output(123, 0)
l2.with_relative_height(2).output(130, 0) l2.with_relative_height(2).output(130, 0)
l2.with_relative_height(1).output(131, 0) l2.with_relative_height(1).output(131, 0)
l2.with_relative_height(..1).output(132, 0) if has_unbounded_range
l2.with_relative_height(..1).output(132, 0)
else
l2.with_relative_height(0..1).output(132, 0)
end
l2.without_relative_height(0..2).output(133, 0) l2.without_relative_height(0..2).output(133, 0)