let helper output correct version in case of error
This commit is contained in:
parent
45bd4bfdc6
commit
7eebc775d6
@ -16,14 +16,22 @@ module Statements
|
|||||||
|
|
||||||
def compare_instructions instruction , expect
|
def compare_instructions instruction , expect
|
||||||
index = 0
|
index = 0
|
||||||
|
start = instruction
|
||||||
begin
|
begin
|
||||||
should = expect[index]
|
should = expect[index]
|
||||||
assert should , "No instruction at #{index}"
|
assert should , "No instruction at #{index}"
|
||||||
assert_equal instruction.class , should , "Expected at #{index+1}"
|
assert_equal instruction.class , should , "Expected at #{index+1}\n#{should(start)}"
|
||||||
index += 1
|
index += 1
|
||||||
instruction = instruction.next
|
instruction = instruction.next
|
||||||
end while( instruction )
|
end while( instruction )
|
||||||
end
|
end
|
||||||
|
def should start
|
||||||
|
str = start.to_ac.to_s
|
||||||
|
str.gsub!("Register::","")
|
||||||
|
ret = ""
|
||||||
|
str.split(",").each_slice(7).each do |line|
|
||||||
|
ret += " " + line.join(",") + " ,\n"
|
||||||
|
end
|
||||||
|
ret
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user