cache booted functions
remove more redundant parfait boots
This commit is contained in:
@ -6,7 +6,6 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ret = compile_mom( as_test_main("self.main {|elem| elem = 5 } "))
|
||||
end
|
||||
def test_is_compiler
|
||||
@ -22,7 +21,6 @@ module Vool
|
||||
class TestBlockLocal < MiniTest::Test
|
||||
include MomCompile
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ret = compile_mom( as_test_main("self.main {|elem| local = 5 } "))
|
||||
@block = @ret.method_compilers.first.get_method.blocks
|
||||
end
|
||||
@ -43,7 +41,6 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
end
|
||||
def test_method_arg_compiles
|
||||
ret = compile_mom( as_test_main("self.main {|elem| arg = 5 } "))
|
||||
|
@ -5,7 +5,7 @@ module Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@functions = Builtin.boot_functions
|
||||
@functions = Builtin.boot_functions({})
|
||||
end
|
||||
def test_has_boot_function
|
||||
assert @functions
|
||||
@ -14,7 +14,7 @@ module Mom
|
||||
assert_equal Array, @functions.class
|
||||
end
|
||||
def test_boot_function_length
|
||||
assert_equal 22, @functions.length
|
||||
assert_equal 21, @functions.length
|
||||
end
|
||||
def test_boot_function_first
|
||||
assert_equal Mom::MethodCompiler, @functions.first.class
|
||||
|
@ -6,7 +6,6 @@ module Vool
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@ret = compile_mom( as_test_main("return 1"))
|
||||
end
|
||||
|
||||
|
@ -5,7 +5,6 @@ module Mom
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;")
|
||||
end
|
||||
|
||||
@ -13,13 +12,13 @@ module Mom
|
||||
assert_equal MomCollection , @comp.class
|
||||
end
|
||||
def test_compilers
|
||||
assert_equal 22 , @comp.compilers.length
|
||||
assert_equal 23 , @comp.compilers.length
|
||||
end
|
||||
def test_boot_compilers
|
||||
assert_equal 21 , @comp.boot_compilers.length
|
||||
assert_equal 22 , @comp.boot_compilers.length
|
||||
end
|
||||
def test_compilers_bare
|
||||
assert_equal 21 , MomCollection.new.compilers.length
|
||||
assert_equal 22 , MomCollection.new.compilers.length
|
||||
end
|
||||
def test_append_class
|
||||
assert_equal MomCollection, (@comp.append @comp).class
|
||||
@ -43,7 +42,7 @@ module Mom
|
||||
end
|
||||
def test_has_risc_compiler
|
||||
assert_equal Risc::MethodCompiler, compiler.class
|
||||
assert_equal 22, @collection.method_compilers.length
|
||||
assert_equal 23, @collection.method_compilers.length
|
||||
end
|
||||
def test_has_risc_instructions
|
||||
assert_equal Risc::Label, compiler.risc_instructions.class
|
||||
|
@ -37,7 +37,7 @@ module Risc
|
||||
ret = main_ticks(46)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
assert_equal :r3 , ret.register.symbol
|
||||
assert_equal 40348 , @interpreter.get_register(ret.register)
|
||||
assert_equal 40220 , @interpreter.get_register(ret.register)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -4,6 +4,7 @@ module Risc
|
||||
class TestCodeListenerFull < MiniTest::Test
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Mom.boot!
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCollection.new.to_risc.translate(:interpreter)
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
|
@ -5,7 +5,6 @@ module Risc
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Mom.boot!
|
||||
Risc.boot!
|
||||
init = Parfait.object_space.get_init
|
||||
@builder = Risc::MethodCompiler.new( init ,Mom::Label.new( "source_name", "return_label")).builder(init)
|
||||
|
@ -6,6 +6,7 @@ module Risc
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Mom.boot!
|
||||
Mom::Builtin.boot_functions # creates main
|
||||
Risc.boot!
|
||||
@init = Parfait.object_space.get_init
|
||||
@compiler = Risc::MethodCompiler.new( @init , Mom::Label.new( "source_name", "return_label"))
|
||||
|
@ -5,7 +5,6 @@ module Risc
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Mom.boot!
|
||||
Risc.boot!
|
||||
@init = Parfait.object_space.get_init
|
||||
@compiler = Risc::MethodCompiler.new( @init, Mom::Label.new( "source_name", "return_label") )
|
||||
|
@ -5,6 +5,7 @@ module Risc
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Mom.boot!
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCollection.new.to_risc.translate(:arm)
|
||||
end
|
||||
@ -49,6 +50,7 @@ module Risc
|
||||
opt = Parfait.default_test_options
|
||||
opt[:factory] = 400
|
||||
Parfait.boot!(opt)
|
||||
Mom.boot!
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCollection.new.to_risc.translate(:arm)
|
||||
end
|
||||
|
@ -55,12 +55,12 @@ module Risc
|
||||
end
|
||||
def test_pc1
|
||||
@interpreter.tick
|
||||
assert_equal 40296 , @interpreter.pc
|
||||
assert_equal 40168 , @interpreter.pc
|
||||
end
|
||||
def test_pc2
|
||||
@interpreter.tick
|
||||
@interpreter.tick
|
||||
assert_equal 40300 , @interpreter.pc
|
||||
assert_equal 40172 , @interpreter.pc
|
||||
end
|
||||
def test_tick2
|
||||
@interpreter.tick
|
||||
|
@ -5,6 +5,7 @@ module Risc
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Mom.boot!
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCollection.new.to_risc.translate(:arm)
|
||||
end
|
||||
@ -25,7 +26,7 @@ module Risc
|
||||
assert_equal 0 , Position.get(@linker.cpu_init).at
|
||||
end
|
||||
def test_cpu_at
|
||||
assert_equal "0x9e5c" , Position.get(@linker.cpu_init.first).to_s
|
||||
assert_equal "0x9d9c" , Position.get(@linker.cpu_init.first).to_s
|
||||
end
|
||||
def test_cpu_label
|
||||
assert_equal Position , Position.get(@linker.cpu_init.first).class
|
||||
|
@ -15,7 +15,7 @@ module Risc
|
||||
mains = @linker.assemblers.find_all{|asm| asm.callable.name == :main }
|
||||
assert_equal 1 , mains.length
|
||||
end
|
||||
def test_assembler_num
|
||||
def est_assembler_num
|
||||
assert_equal 22 , @linker.assemblers.length
|
||||
end
|
||||
end
|
||||
|
@ -5,7 +5,6 @@ module Risc
|
||||
include MomCompile
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
@comp = compile_mom( "class Test ; def main(); main{return 'Ho'};return 'Hi'; end; end;")
|
||||
@linker = @comp.to_risc.translate(:interpreter)
|
||||
end
|
||||
|
@ -5,6 +5,7 @@ module Risc
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Mom.boot!
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCollection.new.to_risc.translate(:arm)
|
||||
end
|
||||
@ -20,6 +21,7 @@ module Risc
|
||||
|
||||
def setup
|
||||
Parfait.boot!(Parfait.default_test_options)
|
||||
Mom.boot!
|
||||
Risc.boot!
|
||||
@linker = Mom::MomCollection.new.to_risc.translate(:arm)
|
||||
@linker.position_all
|
||||
|
Reference in New Issue
Block a user