More rename cleanp
This commit is contained in:
@ -9,7 +9,7 @@ module Risc
|
||||
@string_input = as_main("return 5 + 5")
|
||||
super
|
||||
end
|
||||
#FIXME should be mom macro test, no need to interpret
|
||||
#FIXME should be macro test, no need to interpret
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
|
||||
|
@ -1,18 +1,7 @@
|
||||
## Pre - testing builtin
|
||||
|
||||
In the process of moving builtin from mom to parfait. Considering we started at risc, this
|
||||
is progress.
|
||||
|
||||
Builtin methods should (will) use the Macro idea to actually become code and land in
|
||||
the parfait code.
|
||||
|
||||
On the way there, we start by Testing and moving the old ones. Since we want to be able
|
||||
to test some methods even after the move, without parsing/processing the whole of parfait
|
||||
we have to have a method of "injecting" the single? methods.
|
||||
|
||||
## SlotMachine level
|
||||
|
||||
There a re two test levels to every method. SlotMachine being the first, where we basically just
|
||||
There are two test levels to every method. SlotMachine being the first, where we basically just
|
||||
see if the right SlotMachine instruction has been generated
|
||||
|
||||
## Risc
|
||||
|
@ -4,13 +4,13 @@ module RubyX
|
||||
module MacroHelper
|
||||
def setup
|
||||
whole ="class Space;def main(arg);return;end;end;" + source
|
||||
@mom = RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot(whole)
|
||||
@mom.method_compilers
|
||||
assert_equal SlotMachine::SlotCollection , @mom.class
|
||||
@slot = RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot(whole)
|
||||
@slot.method_compilers
|
||||
assert_equal SlotMachine::SlotCollection , @slot.class
|
||||
assert_equal SlotMachine::MethodCompiler , compiler.class
|
||||
end
|
||||
def compiler
|
||||
@mom.method_compilers.last_compiler
|
||||
@slot.method_compilers.last_compiler
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -11,7 +11,7 @@ means testing every layer for every file.
|
||||
Rather than create parfait tests for every layer (ie in the vool/slot_machine/risc directories)
|
||||
we have one file per parfait file here. Each file tests all layers.
|
||||
|
||||
The usual workflow is to start with a new file and create tests for vool, mom, risc,binary
|
||||
The usual workflow is to start with a new file and create tests for vool, slot_machine, risc,binary
|
||||
in that order. Possibly fixing the compiler on the way. Then adding the file to
|
||||
the RubyXCompiler parfait load list.
|
||||
|
||||
|
@ -28,8 +28,8 @@ module RubyX
|
||||
assert_equal :Data8 , vool[3].name
|
||||
end
|
||||
def test_slot
|
||||
mom = @compiler.ruby_to_slot source
|
||||
assert_equal SlotMachine::SlotCollection , mom.class
|
||||
slot = @compiler.ruby_to_slot source
|
||||
assert_equal SlotMachine::SlotCollection , slot.class
|
||||
end
|
||||
def test_risc
|
||||
risc = compiler.ruby_to_risc( get_preload("Space.main") + source)
|
||||
|
@ -29,8 +29,8 @@ module RubyX
|
||||
vool = @compiler.ruby_to_vool source
|
||||
vool.to_parfait
|
||||
#puts vool
|
||||
mom = vool.to_slot(nil)
|
||||
assert_equal SlotMachine::SlotCollection , mom.class
|
||||
slot = vool.to_slot(nil)
|
||||
assert_equal SlotMachine::SlotCollection , slot.class
|
||||
end
|
||||
def est_risc
|
||||
risc = compiler.ruby_to_risc source
|
||||
|
@ -19,8 +19,8 @@ module RubyX
|
||||
assert_equal :Object , vool.name
|
||||
end
|
||||
def test_slot
|
||||
mom = compiler.ruby_to_slot source
|
||||
assert_equal SlotMachine::SlotCollection , mom.class
|
||||
slot = compiler.ruby_to_slot source
|
||||
assert_equal SlotMachine::SlotCollection , slot.class
|
||||
end
|
||||
def test_risc
|
||||
risc = compiler.ruby_to_risc( get_preload("Space.main") + source)
|
||||
|
@ -13,8 +13,8 @@ module RubyX
|
||||
end
|
||||
|
||||
def test_creates_class_deriviation
|
||||
mom = ruby_to_slot "class Testing ; end"
|
||||
assert mom , "No classes created"
|
||||
slot = ruby_to_slot "class Testing ; end"
|
||||
assert slot , "No classes created"
|
||||
end
|
||||
|
||||
def test_creates_class_with_deriviation
|
||||
|
@ -7,7 +7,7 @@ module SlotMachine
|
||||
end
|
||||
end
|
||||
|
||||
# Most SlotMachineInstructionTests test the risc instructions of the mom instruction
|
||||
# Most SlotMachineInstructionTests test the risc instructions of the slot instruction
|
||||
# quite carefully, ie every instruction, every register.
|
||||
#
|
||||
# This is done with the assert methods in risc_assert
|
||||
|
@ -1,13 +1,13 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Mom
|
||||
module SlotMachine
|
||||
module Builtin
|
||||
class BootTest < MiniTest::Test
|
||||
include Preloader
|
||||
|
||||
def get_compiler(clazz , name)
|
||||
compiler = RubyX::RubyXCompiler.new(RubyX.default_test_options)
|
||||
coll = compiler.ruby_to_mom( get_preload("Space.main;#{clazz}.#{name}") )
|
||||
coll = compiler.ruby_to_slot( get_preload("Space.main;#{clazz}.#{name}") )
|
||||
@method = coll.method_compilers.last_compiler
|
||||
@method
|
||||
end
|
||||
|
@ -62,9 +62,9 @@ module SlotMachine
|
||||
assert_equal 2 , method.frame_type.variable_index(:a)
|
||||
end
|
||||
def constant_setup(input)
|
||||
mom = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot(in_Test(input))
|
||||
assert_equal SlotMachine::SlotCollection , mom.class
|
||||
compiler = mom.method_compilers
|
||||
slot = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot(in_Test(input))
|
||||
assert_equal SlotMachine::SlotCollection , slot.class
|
||||
compiler = slot.method_compilers
|
||||
assert_equal SlotMachine::MethodCompiler , compiler.class
|
||||
compiler
|
||||
end
|
||||
|
@ -43,9 +43,9 @@ module VoolCompile
|
||||
end
|
||||
def compile_main_block( block_input , method_input = "main_local = 5" , preload = nil)
|
||||
source = get_preload(preload) + as_main("#{method_input} ; self.main{|val| #{block_input}}")
|
||||
mom_col = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot( source )
|
||||
compiler = mom_col.method_compilers.find_compiler_name(:main)
|
||||
block = mom_col.method_compilers.find_compiler_name(:main_block)
|
||||
slot_col = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_slot( source )
|
||||
compiler = slot_col.method_compilers.find_compiler_name(:main)
|
||||
block = slot_col.method_compilers.find_compiler_name(:main_block)
|
||||
assert block
|
||||
block.slot_instructions.next
|
||||
end
|
||||
|
@ -37,16 +37,16 @@ module Vool
|
||||
assert_equal Vool::MacroExpression , vool.body.first.body.return_value.class
|
||||
end
|
||||
def test_slot_basic
|
||||
mom = as_slot
|
||||
assert_equal SlotMachine::SlotCollection , mom.class
|
||||
assert_equal SlotMachine::MethodCompiler , mom.method_compilers.class
|
||||
slot = as_slot
|
||||
assert_equal SlotMachine::SlotCollection , slot.class
|
||||
assert_equal SlotMachine::MethodCompiler , slot.method_compilers.class
|
||||
end
|
||||
def test_slot_instructions
|
||||
mom_compiler = as_slot.method_compilers
|
||||
assert_equal SlotMachine::Label , mom_compiler.slot_instructions.class
|
||||
assert_equal SlotMachine::IntOperator , mom_compiler.slot_instructions.next.class
|
||||
assert_equal SlotMachine::SlotLoad , mom_compiler.slot_instructions.next(2).class
|
||||
assert_equal SlotMachine::ReturnJump , mom_compiler.slot_instructions.next(3).class
|
||||
slot_compiler = as_slot.method_compilers
|
||||
assert_equal SlotMachine::Label , slot_compiler.slot_instructions.class
|
||||
assert_equal SlotMachine::IntOperator , slot_compiler.slot_instructions.next.class
|
||||
assert_equal SlotMachine::SlotLoad , slot_compiler.slot_instructions.next(2).class
|
||||
assert_equal SlotMachine::ReturnJump , slot_compiler.slot_instructions.next(3).class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user