Class: OrigenTesters::ATP::Processors::OnPassFailRemover
Overview
Removes most things from embedded on_pass/fail nodes and converts them to the equivalent on_passed/failed condition at the same level as the parent node
Instance Method Summary
collapse
#add_global_flag, #clean_flag, #extract_globals, #extract_volatiles, #global_flag?, #global_flags, #handler_missing, #process, #process_all, #volatile?, #volatile_flags
Instance Method Details
#contains_anything_interesting?(node) ⇒ Boolean
34
35
36
|
# File 'lib/origen_testers/atp/processors/on_pass_fail_remover.rb', line 34
def contains_anything_interesting?(node)
node.children.any? { |n| n.type != :set_result && n.type != :continue && n.type != :set_flag }
end
|
#on_test(node) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/origen_testers/atp/processors/on_pass_fail_remover.rb', line 10
def on_test(node)
on_pass = node.find(:on_pass)
on_fail = node.find(:on_fail)
if on_pass || on_fail
id = node.find(:id)
unless id
fail 'Something has gone wrong, all nodes should have IDs by this point'
end
id = id.value
nodes = [node]
if on_fail && contains_anything_interesting?(on_fail)
nodes << node.updated(:if_failed, [id] + on_fail.children)
nodes[0] = nodes[0].remove(on_fail)
end
if on_pass && contains_anything_interesting?(on_pass)
nodes << node.updated(:if_passed, [id] + on_pass.children)
nodes[0] = nodes[0].remove(on_pass)
end
node.updated(:inline, nodes)
else
node.updated(nil, process_all(node.children))
end
end
|
#run(node) ⇒ Object
6
7
8
|
# File 'lib/origen_testers/atp/processors/on_pass_fail_remover.rb', line 6
def run(node)
process(node)
end
|