minor fixes
This commit is contained in:
parent
f50d7b57a4
commit
f92ea36fe5
1
.gitignore
vendored
1
.gitignore
vendored
@ -39,3 +39,4 @@ pkg
|
|||||||
# Object files
|
# Object files
|
||||||
*.o
|
*.o
|
||||||
log
|
log
|
||||||
|
tmp
|
||||||
|
@ -11,7 +11,7 @@ class Object
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
@length = 36
|
@length = 37
|
||||||
@stdout = "Hello Raisa, I am salama"
|
@stdout = "Hello Raisa, I am salama"
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
@ -31,7 +31,7 @@ class Object
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
@length = 46
|
@length = 47
|
||||||
@stdout = "10"
|
@stdout = "10"
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
@ -53,7 +53,7 @@ class Object
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
HERE
|
HERE
|
||||||
@length = 61
|
@length = 62
|
||||||
@stdout = "else"
|
@stdout = "else"
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
|
@ -3,7 +3,7 @@ require_relative 'helper'
|
|||||||
class TestWord < MiniTest::Test
|
class TestWord < MiniTest::Test
|
||||||
include Fragments
|
include Fragments
|
||||||
|
|
||||||
def test_hello
|
def test_word_new
|
||||||
@string_input = <<HERE
|
@string_input = <<HERE
|
||||||
class Object
|
class Object
|
||||||
Word self.new()
|
Word self.new()
|
||||||
|
@ -20,10 +20,10 @@ HERE
|
|||||||
"LoadConstant","SetSlot","FunctionCall","Label","GetSlot",
|
"LoadConstant","SetSlot","FunctionCall","Label","GetSlot",
|
||||||
"LoadConstant","SetSlot","LoadConstant","SetSlot","LoadConstant",
|
"LoadConstant","SetSlot","LoadConstant","SetSlot","LoadConstant",
|
||||||
"SetSlot","LoadConstant","SetSlot","RegisterTransfer","FunctionCall",
|
"SetSlot","LoadConstant","SetSlot","RegisterTransfer","FunctionCall",
|
||||||
"Label","GetSlot","RegisterTransfer","Syscall","RegisterTransfer",
|
"Label","GetSlot","GetSlot","RegisterTransfer","Syscall",
|
||||||
"RegisterTransfer","SetSlot","Label","FunctionReturn","RegisterTransfer",
|
"RegisterTransfer","RegisterTransfer","SetSlot","Label","FunctionReturn",
|
||||||
"GetSlot","GetSlot","Label","FunctionReturn","RegisterTransfer",
|
"RegisterTransfer","GetSlot","GetSlot","Label","FunctionReturn",
|
||||||
"Syscall","NilClass"]
|
"RegisterTransfer","Syscall","NilClass"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_branch
|
def test_branch
|
||||||
@ -47,13 +47,13 @@ HERE
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_putstring
|
def test_putstring
|
||||||
done = ticks(24)
|
done = ticks(25)
|
||||||
assert_equal Register::Syscall , done.class
|
assert_equal Register::Syscall , done.class
|
||||||
assert_equal "Hello again" , @interpreter.stdout
|
assert_equal "Hello again" , @interpreter.stdout
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_return
|
def test_return
|
||||||
done = ticks(29)
|
done = ticks(30)
|
||||||
assert_equal Register::FunctionReturn , done.class
|
assert_equal Register::FunctionReturn , done.class
|
||||||
assert Register::Label , @interpreter.instruction.class
|
assert Register::Label , @interpreter.instruction.class
|
||||||
assert @interpreter.instruction.is_a?(Register::Instruction) , "not instruction #{@interpreter.instruction}"
|
assert @interpreter.instruction.is_a?(Register::Instruction) , "not instruction #{@interpreter.instruction}"
|
||||||
|
@ -33,8 +33,9 @@ HERE
|
|||||||
end
|
end
|
||||||
|
|
||||||
def write_file
|
def write_file
|
||||||
file_name = caller(3).first.split("in ").last.chop.reverse.chop.reverse
|
file_name = caller(3).first.split("in ").last.chop.sub("`","")
|
||||||
file_name = File.dirname(__FILE__) + "/" + file_name + ".o"
|
return if file_name.include?("run")
|
||||||
|
file_name = "./tmp/" + file_name + ".o"
|
||||||
Register.machine.translate_arm
|
Register.machine.translate_arm
|
||||||
writer = Elf::ObjectWriter.new
|
writer = Elf::ObjectWriter.new
|
||||||
writer.save file_name
|
writer.save file_name
|
||||||
|
Loading…
Reference in New Issue
Block a user