MCPcopy Create free account
hub / github.com/KLayout/klayout / compare

Function compare

testdata/ruby/dbLayoutDiff.rb:26–73  ·  view source on GitHub ↗
(a, b, flags = RBA::LayoutDiff::Verbose)

Source from the content-addressed store, hash-verified

24load("test_prologue.rb")
25
26def compare(a, b, flags = RBA::LayoutDiff::Verbose)
27
28 res = []
29
30 diff = RBA::LayoutDiff::new
31 diff.on_dbu_differs { |a,b| res << "on_dbu_differs #{'%.12g'%a} #{'%.12g'%b}" }
32 diff.on_layer_in_a_only { |a| res << "on_layer_in_a_only #{a}" }
33 diff.on_layer_in_b_only { |b| res << "on_layer_in_b_only #{b}" }
34 diff.on_layer_name_differs { |a,b| res << "on_layer_name_differs #{a} #{b}" }
35 diff.on_cell_name_differs { |a,b| res << "on_cell_name_differs #{a.name} #{b.name}" }
36 diff.on_cell_in_a_only { |a| res << "on_cell_in_a_only #{a.name}" }
37 diff.on_cell_in_b_only { |b| res << "on_cell_in_b_only #{b.name}" }
38 diff.on_bbox_differs { |a,b| res << "on_bbox_differs #{diff.cell_a.name}:#{a.to_s} #{diff.cell_b.name}:#{b.to_s}" }
39 diff.on_begin_cell { |a,b| res << "on_begin_cell #{a.name} #{b.name}" }
40 diff.on_begin_inst_differences { res << "on_begin_inst_differences" }
41 diff.on_instance_in_a_only { |i,p| res << "on_instance_in_a_only #{i.to_s} #{p.to_s}" }
42 diff.on_instance_in_b_only { |i,p| res << "on_instance_in_b_only #{i.to_s} #{p.to_s}" }
43 diff.on_end_inst_differences { res << "on_end_inst_differences" }
44 diff.on_begin_layer { |a,b| res << "on_begin_layer #{diff.layer_info_a.to_s}:#{a.to_s} #{diff.layer_info_b.to_s}:#{b.to_s}" }
45 diff.on_per_layer_bbox_differs { |a,b| res << "on_per_layer_bbox_differs #{diff.cell_a.name}@#{diff.layer_info_a.to_s}:#{a.to_s} #{diff.cell_b.name}@#{diff.layer_info_b.to_s}:#{b.to_s}" }
46 diff.on_begin_polygon_differences { res << "on_begin_polygon_differences" }
47 diff.on_polygon_in_a_only { |p| res << "polygon_in_a_only #{p.to_s}" }
48 diff.on_polygon_in_b_only { |p| res << "polygon_in_b_only #{p.to_s}" }
49 diff.on_end_polygon_differences { res << "on_end_polygon_differences" }
50 diff.on_begin_box_differences { res << "on_begin_box_differences" }
51 diff.on_box_in_a_only { |p| res << "box_in_a_only #{p.to_s}" }
52 diff.on_box_in_b_only { |p| res << "box_in_b_only #{p.to_s}" }
53 diff.on_end_box_differences { res << "on_end_box_differences" }
54 diff.on_begin_path_differences { res << "on_begin_path_differences" }
55 diff.on_path_in_a_only { |p| res << "path_in_a_only #{p.to_s}" }
56 diff.on_path_in_b_only { |p| res << "path_in_b_only #{p.to_s}" }
57 diff.on_end_path_differences { res << "on_end_path_differences" }
58 diff.on_begin_text_differences { res << "on_begin_text_differences" }
59 diff.on_text_in_a_only { |p| res << "text_in_a_only #{p.to_s}" }
60 diff.on_text_in_b_only { |p| res << "text_in_b_only #{p.to_s}" }
61 diff.on_end_text_differences { res << "on_end_text_differences" }
62 diff.on_begin_edge_differences { res << "on_begin_edge_differences" }
63 diff.on_edge_in_a_only { |p| res << "edge_in_a_only #{p.to_s}" }
64 diff.on_edge_in_b_only { |p| res << "edge_in_b_only #{p.to_s}" }
65 diff.on_end_edge_differences { res << "on_end_edge_differences" }
66 diff.on_end_layer { res << "on_end_layer" }
67 diff.on_end_cell { res << "on_end_cell" }
68
69 assert_equal(diff.compare(a, b, flags), false)
70
71 return res.join("\n") + "\n"
72
73end
74
75class DBLayoutDiff_TestClass < TestBase
76

Callers 12

test_1Method · 0.70
test_2Method · 0.70
test_3Method · 0.70
test_4Method · 0.70
test_5Method · 0.70
test_6Method · 0.70
test_1Method · 0.70
test_2Method · 0.70
test_3Method · 0.70
test_4Method · 0.70
test_11Method · 0.70
test_12Method · 0.70

Calls 8

cell_aMethod · 0.80
cell_bMethod · 0.80
layer_info_aMethod · 0.80
layer_info_bMethod · 0.80
nameMethod · 0.45
to_sMethod · 0.45
compareMethod · 0.45
joinMethod · 0.45

Tested by 12

test_1Method · 0.56
test_2Method · 0.56
test_3Method · 0.56
test_4Method · 0.56
test_5Method · 0.56
test_6Method · 0.56
test_1Method · 0.56
test_2Method · 0.56
test_3Method · 0.56
test_4Method · 0.56
test_11Method · 0.56
test_12Method · 0.56