fix remaining tests
rename ripples
This commit is contained in:
parent
c8451d0048
commit
7006c8e3aa
8
.reek
8
.reek
@ -7,7 +7,7 @@ DuplicateMethodCall:
|
||||
FeatureEnvy:
|
||||
exclude:
|
||||
- "Vool::Compiler"
|
||||
- "Vool::RubyCompiler"
|
||||
- "RubyX::RubyCompiler"
|
||||
- "Risc::Interpreter"
|
||||
- "Risc::TextWriter"
|
||||
- "Arm::Translator"
|
||||
@ -15,7 +15,7 @@ FeatureEnvy:
|
||||
TooManyMethods:
|
||||
exclude:
|
||||
- "Vool::Compiler"
|
||||
- "Vool::RubyCompiler"
|
||||
- "RubyX::RubyCompiler"
|
||||
- "Risc::Interpreter"
|
||||
- "Risc::TextWriter"
|
||||
- "Arm::Translator"
|
||||
@ -23,7 +23,7 @@ TooManyMethods:
|
||||
UtilityFunction:
|
||||
exclude:
|
||||
- "Vool::Compiler"
|
||||
- "Vool::RubyCompiler"
|
||||
- "RubyX::RubyCompiler"
|
||||
- "Risc::Interpreter"
|
||||
- "Risc::TextWriter"
|
||||
- "Arm::Translator"
|
||||
@ -31,7 +31,7 @@ UtilityFunction:
|
||||
UncommunicativeMethodName:
|
||||
exclude:
|
||||
- "Vool::Compiler"
|
||||
- "Vool::RubyCompiler"
|
||||
- "RubyX::RubyCompiler"
|
||||
- "Risc::TextWriter"
|
||||
- "Risc::Interpreter"
|
||||
- "Arm::Translator"
|
||||
|
@ -18,7 +18,7 @@ module Elf
|
||||
in_space("def main(arg);#{input};end")
|
||||
end
|
||||
def check(input, file)
|
||||
Vool::RubyXCompiler.ruby_to_binary( input )
|
||||
RubyX::RubyXCompiler.ruby_to_binary( input )
|
||||
writer = Elf::ObjectWriter.new(Risc.machine)
|
||||
writer.save "test/#{file}.o"
|
||||
end
|
||||
|
@ -39,7 +39,7 @@ module Mains
|
||||
def compile(input , file , scp)
|
||||
Risc.machine.boot
|
||||
puts "Compiling test/#{file}.o" if DEBUG
|
||||
Vool::RubyXCompiler.ruby_to_binary( "class Space;def main(arg);#{input};end;end" )
|
||||
RubyX::RubyXCompiler.ruby_to_binary( "class Space;def main(arg);#{input};end;end" )
|
||||
writer = Elf::ObjectWriter.new(Risc.machine)
|
||||
writer.save "test/#{file}.o"
|
||||
object_file = "/tmp/#{file}.o"
|
||||
|
@ -28,7 +28,7 @@ module Risc
|
||||
end
|
||||
def produce_instructions
|
||||
assert @expect , "No output given"
|
||||
Vool::RubyXCompiler.ruby_to_binary as_test_main , :interpreter
|
||||
RubyX::RubyXCompiler.ruby_to_binary as_test_main , :interpreter
|
||||
test = Parfait.object_space.get_class_by_name :Test
|
||||
test.instance_type.get_method(:main).cpu_instructions
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
require_relative "helper"
|
||||
|
||||
module Vool
|
||||
module Risc
|
||||
class TestRiscCompiler < MiniTest::Test
|
||||
include CompilerHelper
|
||||
|
||||
@ -9,7 +9,7 @@ module Vool
|
||||
end
|
||||
|
||||
def create_method
|
||||
vool = RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
vool = RubyX::RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
vool.to_mom(nil)
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
test.get_method(:meth)
|
||||
@ -17,7 +17,7 @@ module Vool
|
||||
|
||||
def test_method_has_source
|
||||
method = create_method
|
||||
assert_equal IvarAssignment , method.source.class
|
||||
assert_equal Vool::IvarAssignment , method.source.class
|
||||
end
|
||||
|
||||
def test_method_has_no_locals
|
||||
@ -37,24 +37,24 @@ module Vool
|
||||
end
|
||||
|
||||
def test_creates_method_statement_in_class
|
||||
clazz = RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5 ;end")
|
||||
assert_equal MethodStatement , clazz.body.class
|
||||
clazz = RubyX::RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5 ;end")
|
||||
assert_equal Vool::MethodStatement , clazz.body.class
|
||||
end
|
||||
|
||||
def test_method_statement_has_class
|
||||
vool = RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
vool = RubyX::RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
clazz = vool.to_mom(nil)
|
||||
assert vool.body.clazz
|
||||
end
|
||||
|
||||
def test_parfait_class_creation
|
||||
vool = RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
vool = RubyX::RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5;end")
|
||||
clazz = vool.to_mom(nil)
|
||||
assert_equal Parfait::Class , vool.body.clazz.class
|
||||
end
|
||||
|
||||
def test_typed_method_instance_type
|
||||
vool = RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5; @ibar = 4;end")
|
||||
vool = RubyX::RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5; @ibar = 4;end")
|
||||
vool.to_mom(nil)
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
method = test.instance_type.get_method(:meth)
|
||||
@ -63,7 +63,7 @@ module Vool
|
||||
end
|
||||
|
||||
def test_vool_method_has_one_local
|
||||
vool = RubyXCompiler.ruby_to_vool in_Test("def meth; local = 5 ; a = 6;end")
|
||||
vool = RubyX::RubyXCompiler.ruby_to_vool in_Test("def meth; local = 5 ; a = 6;end")
|
||||
vool.to_mom(nil)
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
method = test.get_method(:meth)
|
||||
@ -73,7 +73,7 @@ module Vool
|
||||
end
|
||||
|
||||
def test_typed_method_has_one_local
|
||||
vool = RubyXCompiler.ruby_to_vool in_Test("def meth; local = 5 ; a = 6;end")
|
||||
vool = RubyX::RubyXCompiler.ruby_to_vool in_Test("def meth; local = 5 ; a = 6;end")
|
||||
vool.to_mom(nil)
|
||||
test = Parfait.object_space.get_class_by_name(:Test)
|
||||
method = test.instance_type.get_method(:meth)
|
||||
|
@ -61,6 +61,7 @@ module Vool
|
||||
end
|
||||
end
|
||||
class TestSendReceiverType < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
|
@ -1,21 +1,22 @@
|
||||
require_relative 'helper'
|
||||
|
||||
module RubyX
|
||||
module Vool
|
||||
class TestWhileStatement < MiniTest::Test
|
||||
include RubyTests
|
||||
|
||||
def basic_while
|
||||
"while(10 < 12) ; true ; end"
|
||||
end
|
||||
def test_while_basic
|
||||
lst = RubyCompiler.compile( basic_while )
|
||||
lst = compile( basic_while )
|
||||
assert_equal WhileStatement , lst.class
|
||||
end
|
||||
def test_while_basic_cond
|
||||
lst = RubyCompiler.compile( basic_while )
|
||||
lst = compile( basic_while )
|
||||
assert_equal ScopeStatement , lst.condition.class
|
||||
end
|
||||
def test_while_basic_branches
|
||||
lst = RubyCompiler.compile( basic_while )
|
||||
lst = compile( basic_while )
|
||||
assert_equal TrueConstant , lst.body.class
|
||||
end
|
||||
|
||||
@ -23,15 +24,15 @@ module RubyX
|
||||
"true while(false)"
|
||||
end
|
||||
def test_while_reverse_branches
|
||||
lst = RubyCompiler.compile( reverse_while )
|
||||
lst = compile( reverse_while )
|
||||
assert_equal WhileStatement , lst.class
|
||||
end
|
||||
def test_while_reverse_cond
|
||||
lst = RubyCompiler.compile( reverse_while )
|
||||
lst = compile( reverse_while )
|
||||
assert_equal ScopeStatement , lst.condition.class
|
||||
end
|
||||
def test_while_reverse_branches
|
||||
lst = RubyCompiler.compile( reverse_while )
|
||||
lst = compile( reverse_while )
|
||||
assert_equal TrueConstant , lst.body.class
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ module RubyX
|
||||
|
||||
def test_class_body_is_scope
|
||||
clazz = RubyXCompiler.ruby_to_vool in_Test("def meth; @ivar = 5 ;end")
|
||||
assert_equal MethodStatement , clazz.body.class
|
||||
assert_equal Vool::MethodStatement , clazz.body.class
|
||||
end
|
||||
|
||||
def test_creates_class_without_deriviation
|
||||
@ -49,8 +49,8 @@ module RubyX
|
||||
def test_creates_class_deriviation
|
||||
vool = RubyXCompiler.ruby_to_vool "class Testing ; end"
|
||||
mom = vool.to_mom(nil)
|
||||
assert_equal ClassStatement , vool.class
|
||||
assert mom , "No classes created"
|
||||
assert_equal Vool::ClassStatement , vool.class
|
||||
#assert mom , "No classes created"
|
||||
end
|
||||
|
||||
def test_creates_class_with_deriviation
|
||||
|
@ -24,7 +24,7 @@ module MomCompile
|
||||
def compile_first_method( input )
|
||||
# works a lot like Vool.ruby_to_vool
|
||||
# but here we return the intermediate mom instructions that are otherwise not available
|
||||
statements = Vool::RubyCompiler.compile as_test_main( input )
|
||||
statements = RubyX::RubyCompiler.compile as_test_main( input )
|
||||
statements = statements.normalize
|
||||
res = statements.to_mom(nil)
|
||||
assert_equal Parfait::Class , statements.clazz.class , statements
|
||||
|
@ -8,7 +8,7 @@ module Risc
|
||||
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
Vool::RubyXCompiler.ruby_to_binary( @string_input , :interpreter)
|
||||
RubyX::RubyXCompiler.ruby_to_binary( @string_input , :interpreter)
|
||||
@interpreter = Interpreter.new
|
||||
@interpreter.start_machine
|
||||
end
|
||||
|
@ -6,7 +6,7 @@ module Vool
|
||||
class NormTest < MiniTest::Test
|
||||
|
||||
def normalize(input)
|
||||
RubyCompiler.compile(input).normalize
|
||||
RubyX::RubyCompiler.compile(input).normalize
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user