Class: OrigenTesters::ATP::Formatters::Datalog
Overview
Outputs the given AST to something resembling an ATE datalog, this can optionally be rendered to a file or the console (the default).
Instance Method Summary
collapse
#format, format, run, #run_and_format, run_and_format
Methods inherited from Processor
#add_global_flag, #clean_flag, #extract_globals, #extract_volatiles, #global_flag?, #global_flags, #handler_missing, #process, #process_all, #run, #volatile?, #volatile_flags
Instance Method Details
#on_flow(node) ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/origen_testers/atp/formatters/datalog.rb', line 7
def on_flow(node)
str = 'Number'.ljust(15)
str += 'Result'.ljust(9)
str += 'Name'.ljust(55)
str += 'Pattern'.ljust(55)
str += 'ID'
puts str
process_all(node.children)
end
|
#on_log(node) ⇒ Object
41
42
43
|
# File 'lib/origen_testers/atp/formatters/datalog.rb', line 41
def on_log(node)
puts "// #{node.value}"
end
|
#on_render(node) ⇒ Object
35
36
37
38
39
|
# File 'lib/origen_testers/atp/formatters/datalog.rb', line 35
def on_render(node)
puts '************ Directly rendered flow snippet ************'
puts node.value
puts '********************************************************'
end
|
#on_set_result(node) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/origen_testers/atp/formatters/datalog.rb', line 45
def on_set_result(node)
bin = node.find(:bin).try(:value)
sbin = node.find(:softbin).try(:value)
desc = node.find(:description).try(:value)
if node.to_a[0] == 'pass'
str = " PASS #{bin} #{sbin}"
color = :green
else
str = " FAIL #{bin} #{sbin}"
color = :red
end
str += " (#{desc})" if desc
puts '---------------------------------------------------------------------------------------------------------------------------------------------------------'
puts str.send(color)
puts '---------------------------------------------------------------------------------------------------------------------------------------------------------'
end
|
#on_test(node) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/origen_testers/atp/formatters/datalog.rb', line 17
def on_test(node)
str = "#{node.find(:number).try(:value)}".ljust(15)
if node.find(:failed)
str += 'FAIL'.ljust(9).red
else
str += 'PASS'.ljust(9)
end
if n = node.find(:name)
name = n.value
else
name = node.find(:object).value['Test']
end
str += "#{name}".ljust(55)
str += "#{node.find(:object).value['Pattern']}".ljust(55)
str += "#{node.find(:id).value}"
puts str
end
|