-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.rb
More file actions
36 lines (32 loc) · 925 Bytes
/
Copy pathtest.rb
File metadata and controls
36 lines (32 loc) · 925 Bytes
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
tests = {
"hello_world" => "Hello World",
"factorial" => "120",
"str_concat" => "HelloWorld",
"if" => "OK",
"end" => "Antes de terminar",
"resta_str" => "hola te va espero que muy ",
"array_sum" => "[1, 2, 3, 4, 5, 5, 5]",
"array_sub" => "[como, vaaa]",
"array_sort" => "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]",
"array_append" => "[1, 2, 3, 4, 5, Hola]",
"empty_array" => "[]",
"precedencia_1" => "31",
"precedencia_2" => "1holahola",
"asociatividad_1" => "2hola",
"asociatividad_2" => "hola210",
"stringdiv" => "[ab, cd, ef]"
}
results = {}
%x(cd compiler ; make all ; cd ..)
tests.each do |program, expected|
%x(./compile.sh ./tests/#{program}.pr)
res = %x(./prose.out)
if (res.chomp == expected)
results[program] = "OK"
else
results[program] = "FAILED -> (expected: #{expected}, real: #{res})"
end
end
results.each do |program, result|
puts "#{program} => #{result}"
end