Rename Vool to Sol
Simple is really the descriptive name for the layer Sure, it is "virtual" but that is not as important as the fact that it is simple (or simplified) Also objct (based really) is better, since orientated implies it is a little like that, but only orientated, not really it. Sol only has objects, nothing else Just cause i was renaming anyway
This commit is contained in:
@ -5,18 +5,18 @@ module RubyX
|
||||
module RubyXHelper
|
||||
def setup
|
||||
end
|
||||
def ruby_to_vool(input, options = {})
|
||||
def ruby_to_sol(input, options = {})
|
||||
options = RubyX.default_test_options.merge(options)
|
||||
RubyXCompiler.new(options).ruby_to_vool(input)
|
||||
RubyXCompiler.new(options).ruby_to_sol(input)
|
||||
end
|
||||
def ruby_to_slot(input , options = {})
|
||||
options = RubyX.default_test_options.merge(options)
|
||||
RubyXCompiler.new(options).ruby_to_slot(input)
|
||||
end
|
||||
def compile_in_test( input , options = {})
|
||||
vool = ruby_to_vool(in_Test(input) , options)
|
||||
vool.to_parfait
|
||||
vool.to_slot(nil)
|
||||
sol = ruby_to_sol(in_Test(input) , options)
|
||||
sol.to_parfait
|
||||
sol.to_slot(nil)
|
||||
itest = Parfait.object_space.get_class_by_name(:Test)
|
||||
assert itest
|
||||
itest
|
||||
|
@ -8,10 +8,10 @@ Since we need Parfait in the runtime, we need to parse it and compile it.
|
||||
And since it is early days, we expect errors at every level during this process, which
|
||||
means testing every layer for every file.
|
||||
|
||||
Rather than create parfait tests for every layer (ie in the vool/slot_machine/risc directories)
|
||||
Rather than create parfait tests for every layer (ie in the sol/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, slot_machine, risc,binary
|
||||
The usual workflow is to start with a new file and create tests for sol, slot_machine, risc,binary
|
||||
in that order. Possibly fixing the compiler on the way. Then adding the file to
|
||||
the RubyXCompiler parfait load list.
|
||||
|
||||
|
@ -8,7 +8,7 @@ module RubyX
|
||||
|
||||
def setup
|
||||
@compiler = compiler
|
||||
@compiler.ruby_to_vool load_parfait(:object)
|
||||
@compiler.ruby_to_sol load_parfait(:object)
|
||||
end
|
||||
def source
|
||||
load_parfait(:data_object)
|
||||
@ -17,15 +17,15 @@ module RubyX
|
||||
assert source.include?("class DataObject")
|
||||
assert source.length > 1500 , source.length
|
||||
end
|
||||
def test_vool
|
||||
vool = @compiler.ruby_to_vool source
|
||||
assert_equal Vool::ScopeStatement , vool.class
|
||||
assert_equal Vool::ClassExpression , vool[0].class
|
||||
assert_equal Vool::ClassExpression , vool[1].class
|
||||
assert_equal Vool::ClassExpression , vool[2].class
|
||||
assert_equal :DataObject , vool[1].name
|
||||
assert_equal :Data4 , vool[2].name
|
||||
assert_equal :Data8 , vool[3].name
|
||||
def test_sol
|
||||
sol = @compiler.ruby_to_sol source
|
||||
assert_equal Sol::ScopeStatement , sol.class
|
||||
assert_equal Sol::ClassExpression , sol[0].class
|
||||
assert_equal Sol::ClassExpression , sol[1].class
|
||||
assert_equal Sol::ClassExpression , sol[2].class
|
||||
assert_equal :DataObject , sol[1].name
|
||||
assert_equal :Data4 , sol[2].name
|
||||
assert_equal :Data8 , sol[3].name
|
||||
end
|
||||
def test_slot
|
||||
slot = @compiler.ruby_to_slot source
|
||||
|
@ -5,8 +5,8 @@ module RubyX
|
||||
include ParfaitHelper
|
||||
def setup
|
||||
@compiler = compiler
|
||||
@compiler.ruby_to_vool load_parfait(:object)
|
||||
@compiler.ruby_to_vool load_parfait(:data_object)
|
||||
@compiler.ruby_to_sol load_parfait(:object)
|
||||
@compiler.ruby_to_sol load_parfait(:data_object)
|
||||
end
|
||||
def source
|
||||
get_preload("Space.main") + load_parfait(:integer)
|
||||
@ -15,21 +15,21 @@ module RubyX
|
||||
assert source.include?("class Integer")
|
||||
assert source.length > 1500 , source.length
|
||||
end
|
||||
def test_vool
|
||||
vool = @compiler.ruby_to_vool source
|
||||
assert_equal Vool::ScopeStatement , vool.class
|
||||
assert_equal Vool::ClassExpression , vool[0].class
|
||||
assert_equal Vool::ClassExpression , vool[1].class
|
||||
assert_equal Vool::ClassExpression , vool[2].class
|
||||
assert_equal :DataObject , vool[1].name
|
||||
assert_equal :Data4 , vool[2].name
|
||||
assert_equal :Data8 , vool[3].name
|
||||
def test_sol
|
||||
sol = @compiler.ruby_to_sol source
|
||||
assert_equal Sol::ScopeStatement , sol.class
|
||||
assert_equal Sol::ClassExpression , sol[0].class
|
||||
assert_equal Sol::ClassExpression , sol[1].class
|
||||
assert_equal Sol::ClassExpression , sol[2].class
|
||||
assert_equal :DataObject , sol[1].name
|
||||
assert_equal :Data4 , sol[2].name
|
||||
assert_equal :Data8 , sol[3].name
|
||||
end
|
||||
def test_slot
|
||||
vool = @compiler.ruby_to_vool source
|
||||
vool.to_parfait
|
||||
#puts vool
|
||||
slot = vool.to_slot(nil)
|
||||
sol = @compiler.ruby_to_sol source
|
||||
sol.to_parfait
|
||||
#puts sol
|
||||
slot = sol.to_slot(nil)
|
||||
assert_equal SlotMachine::SlotCollection , slot.class
|
||||
end
|
||||
def est_risc
|
||||
|
@ -13,10 +13,10 @@ module RubyX
|
||||
assert source.include?("class Object")
|
||||
assert source.length > 2000
|
||||
end
|
||||
def test_vool
|
||||
vool = compiler.ruby_to_vool source
|
||||
assert_equal Vool::ClassExpression , vool.class
|
||||
assert_equal :Object , vool.name
|
||||
def test_sol
|
||||
sol = compiler.ruby_to_sol source
|
||||
assert_equal Sol::ClassExpression , sol.class
|
||||
assert_equal :Object , sol.name
|
||||
end
|
||||
def test_slot
|
||||
slot = compiler.ruby_to_slot source
|
||||
|
@ -25,26 +25,26 @@ module RubyX
|
||||
assert_equal Ruby::ClassStatement , compiled[2].class
|
||||
assert_equal :TestObject , compiled[2].name
|
||||
end
|
||||
def test_vool_object
|
||||
vool = Ruby::RubyCompiler.compile(@input).to_vool
|
||||
assert_equal Vool::ScopeStatement , vool.class
|
||||
assert_equal Vool::ClassExpression , vool.first.class
|
||||
def test_sol_object
|
||||
sol = Ruby::RubyCompiler.compile(@input).to_sol
|
||||
assert_equal Sol::ScopeStatement , sol.class
|
||||
assert_equal Sol::ClassExpression , sol.first.class
|
||||
end
|
||||
def test_vool_helper
|
||||
vool = Ruby::RubyCompiler.compile(@input).to_vool
|
||||
assert_equal Vool::ClassExpression , vool[1].class
|
||||
assert_equal :ParfaitTest , vool[1].name
|
||||
def test_sol_helper
|
||||
sol = Ruby::RubyCompiler.compile(@input).to_sol
|
||||
assert_equal Sol::ClassExpression , sol[1].class
|
||||
assert_equal :ParfaitTest , sol[1].name
|
||||
end
|
||||
def test_vool_test
|
||||
vool = Ruby::RubyCompiler.compile(@input).to_vool
|
||||
assert_equal Vool::ClassExpression , vool[2].class
|
||||
assert_equal :TestObject , vool[2].name
|
||||
def test_sol_test
|
||||
sol = Ruby::RubyCompiler.compile(@input).to_sol
|
||||
assert_equal Sol::ClassExpression , sol[2].class
|
||||
assert_equal :TestObject , sol[2].name
|
||||
end
|
||||
def test_vool_methods
|
||||
vool = Ruby::RubyCompiler.compile(@input).to_vool
|
||||
assert_equal Vool::Statements , vool[2].body.class
|
||||
vool[2].body.statements.each do |st|
|
||||
assert_equal Vool::MethodExpression , st.class
|
||||
def test_sol_methods
|
||||
sol = Ruby::RubyCompiler.compile(@input).to_sol
|
||||
assert_equal Sol::Statements , sol[2].body.class
|
||||
sol[2].body.statements.each do |st|
|
||||
assert_equal Sol::MethodExpression , st.class
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -54,15 +54,15 @@ module RubyX
|
||||
|
||||
def self.runnable_methods
|
||||
input = load_parfait(:object) + load_parfait_test(:object)
|
||||
vool = Ruby::RubyCompiler.compile(input).to_vool
|
||||
sol = Ruby::RubyCompiler.compile(input).to_sol
|
||||
tests = [ ]
|
||||
vool[2].body.statements.each do |method|
|
||||
sol[2].body.statements.each do |method|
|
||||
tests << method.name
|
||||
self.send(:define_method, method.name ) do
|
||||
code = input + <<MAIN
|
||||
class Space
|
||||
def main(args)
|
||||
test = #{vool[2].name}.new
|
||||
test = #{sol[2].name}.new
|
||||
test.setup
|
||||
test.#{method.name}
|
||||
end
|
||||
|
@ -16,15 +16,15 @@ module RubyX
|
||||
end
|
||||
|
||||
def test_class_body_is_scope
|
||||
clazz = ruby_to_vool in_Test("def meth; @ivar = 5 ;end")
|
||||
assert_equal Vool::Statements , clazz.body.class
|
||||
assert_equal Vool::MethodExpression , clazz.body.first.class
|
||||
clazz = ruby_to_sol in_Test("def meth; @ivar = 5 ;end")
|
||||
assert_equal Sol::Statements , clazz.body.class
|
||||
assert_equal Sol::MethodExpression , clazz.body.first.class
|
||||
end
|
||||
|
||||
def test_space_is_unchanged_by_compile
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
space1 = Parfait.object_space.get_class_by_name(:Space)
|
||||
compiler.ruby_to_vool "class Space ;end"
|
||||
compiler.ruby_to_sol "class Space ;end"
|
||||
space2 = Parfait.object_space.get_class_by_name(:Space)
|
||||
assert_equal space1 , space2
|
||||
end
|
||||
@ -32,7 +32,7 @@ module RubyX
|
||||
def test_space_type_is_unchanged_by_compile
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
space1 = Parfait.object_space.get_type_by_class_name(:Space)
|
||||
compiler.ruby_to_vool "class Space ;end"
|
||||
compiler.ruby_to_sol "class Space ;end"
|
||||
space2 = Parfait.object_space.get_type_by_class_name(:Space)
|
||||
assert_equal space1 , space2
|
||||
end
|
||||
|
@ -27,7 +27,7 @@ module RubyX
|
||||
def test_space_type_is_unchanged_by_compile
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
space1 = Parfait.object_space.get_type_by_class_name(:Space)
|
||||
compiler.ruby_to_vool "class Space ;end"
|
||||
compiler.ruby_to_sol "class Space ;end"
|
||||
space2 = Parfait.object_space.get_type_by_class_name(:Space)
|
||||
assert_equal space1 , space2
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ module RubyX
|
||||
|
||||
def test_load
|
||||
object = Parfait.object_space.get_class_by_name(:Object)
|
||||
assert_equal Parfait::VoolMethod , object.get_instance_method(:set_type).class
|
||||
assert_equal Parfait::SolMethod , object.get_instance_method(:set_type).class
|
||||
assert_equal Parfait::CallableMethod , object.instance_type.get_method(:set_type).class
|
||||
end
|
||||
end
|
||||
|
@ -17,23 +17,23 @@ module RubyX
|
||||
@linker = RubyXCompiler.ruby_to_binary(space_source_for("main"), RubyX.interpreter_test_options)
|
||||
assert_equal Risc::Linker , @linker.class
|
||||
end
|
||||
def test_one_vool_call
|
||||
def test_one_sol_call
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
compiler.ruby_to_vool(space_source_for("main"))
|
||||
assert_equal Vool::ClassExpression , compiler.vool.class
|
||||
compiler.ruby_to_sol(space_source_for("main"))
|
||||
assert_equal Sol::ClassExpression , compiler.sol.class
|
||||
end
|
||||
def test_two_vool_calls
|
||||
def test_two_sol_calls
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
compiler.ruby_to_vool(space_source_for("main"))
|
||||
compiler.ruby_to_vool(space_source_for("twain"))
|
||||
assert_equal Vool::ScopeStatement , compiler.vool.class
|
||||
assert_equal 2 , compiler.vool.length
|
||||
compiler.ruby_to_sol(space_source_for("main"))
|
||||
compiler.ruby_to_sol(space_source_for("twain"))
|
||||
assert_equal Sol::ScopeStatement , compiler.sol.class
|
||||
assert_equal 2 , compiler.sol.length
|
||||
end
|
||||
def test_bin_two_sources
|
||||
compiler = RubyXCompiler.new(RubyX.default_test_options)
|
||||
compiler.ruby_to_vool(space_source_for("main"))
|
||||
compiler.ruby_to_vool(space_source_for("twain"))
|
||||
assert_equal 2 , compiler.vool.length
|
||||
compiler.ruby_to_sol(space_source_for("main"))
|
||||
compiler.ruby_to_sol(space_source_for("twain"))
|
||||
assert_equal 2 , compiler.sol.length
|
||||
linker = compiler.to_binary(:interpreter)
|
||||
assert_equal Risc::Linker , linker.class
|
||||
assert_equal 4 , linker.assemblers.length
|
||||
|
Reference in New Issue
Block a user