First part of int allocation
implemented allocate_int instead of add_new_int
This commit is contained in:
@ -28,6 +28,11 @@ module Risc
|
||||
def test_not_alloc_space
|
||||
assert_raises {@builder.space}
|
||||
end
|
||||
def test_reset
|
||||
assert_equal :r1 , @builder.integer!.symbol
|
||||
@builder.reset_names
|
||||
assert_equal :r1 , @builder.integer!.symbol # would raise if it existed
|
||||
end
|
||||
def test_next_message
|
||||
reg = @builder.next_message!
|
||||
assert_equal :r1 , reg.symbol
|
||||
|
@ -32,5 +32,13 @@ module Risc
|
||||
assert_equal :Integer , @builder.space.type.class_name
|
||||
assert_equal :Space , @builder.integer.type.class_name
|
||||
end
|
||||
def test_allocate_returns
|
||||
int = @builder.allocate_int
|
||||
assert_equal :r1 , int.symbol
|
||||
end
|
||||
def test_allocate_len
|
||||
int = @builder.allocate_int
|
||||
assert_equal 41 , @builder.compiler.risc_instructions.length
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user