Test complied parfait tests

this makes it obvious that we need a working raise
and a correct method_missing, so we can diagnose the 
resulting errors
This commit is contained in:
Torsten Rüger 2019-09-14 20:12:33 +03:00
parent 56398e1127
commit b36ba42990
3 changed files with 37 additions and 14 deletions

View File

@ -31,7 +31,7 @@ module Risc
end end
end end
# dynamic version of an Branch branch that jumps to the contents # dynamic version of an Branch that jumps to the contents
# of a register instead of a hardcoded address # of a register instead of a hardcoded address
# As Branches jump to Labels, this is not derived from Branch # As Branches jump to Labels, this is not derived from Branch
# PS: to conditionally jump to a dynamic adddress we do a normal branch # PS: to conditionally jump to a dynamic adddress we do a normal branch

View File

@ -1,6 +1,5 @@
require_relative "../helper" require_relative "../helper"
# TODO move these to interpreter dir
module Risc module Risc
module Macro module Macro
class IntCmp < Minitest::Test class IntCmp < Minitest::Test

View File

@ -1,12 +1,11 @@
require_relative "rt_helper" require_relative "rt_helper"
module RubyX module RubyX
class ObjectTest < MiniTest::Test class ObjectSourceTest < MiniTest::Test
include ParfaitHelper include ParfaitHelper
def setup def setup
@input = load_parfait(:object) + load_parfait_test(:object) @input = load_parfait(:object) + load_parfait_test(:object)
end end
def test_load def test_load
assert @input.include? "ParfaitTest" assert @input.include? "ParfaitTest"
assert @input.include? "class Object" assert @input.include? "class Object"
@ -41,16 +40,41 @@ module RubyX
assert_equal Vool::ClassExpression , vool[2].class assert_equal Vool::ClassExpression , vool[2].class
assert_equal :TestObject , vool[2].name assert_equal :TestObject , vool[2].name
end end
def test_vool_methods
def est_basics vool = Ruby::RubyCompiler.compile(@input).to_vool
risc = compiler.ruby_to_risc @input , :interpreter assert_equal Vool::Statements , vool[2].body.class
assert_equal Risc::Linker , risc.class vool[2].body.statements.each do |st|
end assert_equal Vool::MethodExpression , st.class
end
def test_run_all
@input = "class Space;def main(arg); return 'hi';end;end;" + @input
run_input
assert_equal "" , @interpreter.stdout
end end
end end
class TestObjectRtTest < Minitest::Test
self.class.include ParfaitHelper
include Risc::Ticker
def self.runnable_methods
input = load_parfait(:object) + load_parfait_test(:object)
vool = Ruby::RubyCompiler.compile(input).to_vool
tests = [ ]
vool[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.setup
test.#{method.name}
end
end
MAIN
@preload = "all"
# ticks = run_input(code)
# assert_equal "" , @interpreter.stdout
end
end
tests
end
end
end end