Class: 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
Methods inherited from Processor
#handler_missing, #n, #n0, #n1, #process, #run
Instance Method Details
#on_flow(node) ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/atp/formatters/datalog.rb', line 7
def on_flow(node)
str = 'Number'.ljust(15)
str += 'Result'.ljust(9)
str += 'Name'.ljust(55)
str += 'Test'.ljust(55)
str += 'ID'
puts str
process_all(node.children)
end
|
#on_log(node) ⇒ Object
36
37
38
|
# File 'lib/atp/formatters/datalog.rb', line 36
def on_log(node)
puts "// #{node.value}"
end
|
#on_render(node) ⇒ Object
30
31
32
33
34
|
# File 'lib/atp/formatters/datalog.rb', line 30
def on_render(node)
puts '************ Directly rendered flow snippet ************'
puts node.value
puts '********************************************************'
end
|
#on_set_result(node) ⇒ Object
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/atp/formatters/datalog.rb', line 40
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
|
# File 'lib/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
str += "#{node.find(:name).value}".ljust(55)
str += "#{node.find(:object).value}".ljust(55)
str += "#{node.find(:id).value}"
puts str
end
|