minor fixes

This commit is contained in:
Torsten Ruger 2015-11-16 18:02:13 +02:00
parent f50d7b57a4
commit f92ea36fe5
6 changed files with 14 additions and 12 deletions

1
.gitignore vendored
View File

@ -39,3 +39,4 @@ pkg
# Object files
*.o
log
tmp

View File

@ -11,7 +11,7 @@ class Object
end
end
HERE
@length = 36
@length = 37
@stdout = "Hello Raisa, I am salama"
check
end

View File

@ -31,7 +31,7 @@ class Object
end
end
HERE
@length = 46
@length = 47
@stdout = "10"
check
end
@ -53,7 +53,7 @@ class Object
end
end
HERE
@length = 61
@length = 62
@stdout = "else"
check
end

View File

@ -3,7 +3,7 @@ require_relative 'helper'
class TestWord < MiniTest::Test
include Fragments
def test_hello
def test_word_new
@string_input = <<HERE
class Object
Word self.new()

View File

@ -20,10 +20,10 @@ HERE
"LoadConstant","SetSlot","FunctionCall","Label","GetSlot",
"LoadConstant","SetSlot","LoadConstant","SetSlot","LoadConstant",
"SetSlot","LoadConstant","SetSlot","RegisterTransfer","FunctionCall",
"Label","GetSlot","RegisterTransfer","Syscall","RegisterTransfer",
"RegisterTransfer","SetSlot","Label","FunctionReturn","RegisterTransfer",
"GetSlot","GetSlot","Label","FunctionReturn","RegisterTransfer",
"Syscall","NilClass"]
"Label","GetSlot","GetSlot","RegisterTransfer","Syscall",
"RegisterTransfer","RegisterTransfer","SetSlot","Label","FunctionReturn",
"RegisterTransfer","GetSlot","GetSlot","Label","FunctionReturn",
"RegisterTransfer","Syscall","NilClass"]
end
def test_branch
@ -47,13 +47,13 @@ HERE
end
def test_putstring
done = ticks(24)
done = ticks(25)
assert_equal Register::Syscall , done.class
assert_equal "Hello again" , @interpreter.stdout
end
def test_return
done = ticks(29)
done = ticks(30)
assert_equal Register::FunctionReturn , done.class
assert Register::Label , @interpreter.instruction.class
assert @interpreter.instruction.is_a?(Register::Instruction) , "not instruction #{@interpreter.instruction}"

View File

@ -33,8 +33,9 @@ HERE
end
def write_file
file_name = caller(3).first.split("in ").last.chop.reverse.chop.reverse
file_name = File.dirname(__FILE__) + "/" + file_name + ".o"
file_name = caller(3).first.split("in ").last.chop.sub("`","")
return if file_name.include?("run")
file_name = "./tmp/" + file_name + ".o"
Register.machine.translate_arm
writer = Elf::ObjectWriter.new
writer.save file_name