-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml_generator.rb
More file actions
45 lines (42 loc) · 1.02 KB
/
html_generator.rb
File metadata and controls
45 lines (42 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
load "writer.rb"
class Html
def initialize(number)
@test_number = number
end
def generate_html
file_name = "tests/test_#{@test_number}_html.html"
gosho = File.open(File.expand_path(file_name), "w")
gosho.puts "<html><body>"
gosho.puts "<div>"
File.open("tests/test_#{@test_number}.txt", "r") do |f|
f.each_line do |line|
if line=="\n"
gosho.puts "<p> ------------------------------------------------------ </p>"
else
gosho.puts "<p>#{line}</p>"
end
end
f.close
gosho.puts "</div>"
gosho.puts "</body></html>"
gosho.close
end
end
def generate_html_results
counter = 1
file_name = "tests/test_#{@test_number}_results_html.html"
gosho = File.open(File.expand_path(file_name), "w")
gosho.puts "<html><body>"
gosho.puts "<div>"
File.open("tests/test_#{@test_number}_results.txt", "r") do |f|
f.each_line do |line|
gosho.puts "<p>#{counter}: #{line}</p>"
counter=counter+1
end
f.close
gosho.puts "</div>"
gosho.puts "</body></html>"
gosho.close
end
end
end