From b36ba4299048017a776209dfb4515ec2c3f1b0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20R=C3=BCger?= Date: Sat, 14 Sep 2019 20:12:33 +0300 Subject: [PATCH] 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 --- lib/risc/instructions/branch.rb | 2 +- test/risc/interpreter/builtin/test_int_cmp.rb | 1 - test/rubyx/rt_parfait/test_object.rb | 48 ++++++++++++++----- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/lib/risc/instructions/branch.rb b/lib/risc/instructions/branch.rb index 66e12420..23fae388 100644 --- a/lib/risc/instructions/branch.rb +++ b/lib/risc/instructions/branch.rb @@ -31,7 +31,7 @@ module Risc 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 # As Branches jump to Labels, this is not derived from Branch # PS: to conditionally jump to a dynamic adddress we do a normal branch diff --git a/test/risc/interpreter/builtin/test_int_cmp.rb b/test/risc/interpreter/builtin/test_int_cmp.rb index 7e148738..732b4abd 100644 --- a/test/risc/interpreter/builtin/test_int_cmp.rb +++ b/test/risc/interpreter/builtin/test_int_cmp.rb @@ -1,6 +1,5 @@ require_relative "../helper" -# TODO move these to interpreter dir module Risc module Macro class IntCmp < Minitest::Test diff --git a/test/rubyx/rt_parfait/test_object.rb b/test/rubyx/rt_parfait/test_object.rb index 24c21a80..d645a014 100644 --- a/test/rubyx/rt_parfait/test_object.rb +++ b/test/rubyx/rt_parfait/test_object.rb @@ -1,12 +1,11 @@ require_relative "rt_helper" module RubyX - class ObjectTest < MiniTest::Test + class ObjectSourceTest < MiniTest::Test include ParfaitHelper def setup @input = load_parfait(:object) + load_parfait_test(:object) end - def test_load assert @input.include? "ParfaitTest" assert @input.include? "class Object" @@ -41,16 +40,41 @@ module RubyX assert_equal Vool::ClassExpression , vool[2].class assert_equal :TestObject , vool[2].name end - - def est_basics - risc = compiler.ruby_to_risc @input , :interpreter - assert_equal Risc::Linker , risc.class - end - - def test_run_all - @input = "class Space;def main(arg); return 'hi';end;end;" + @input - run_input - assert_equal "" , @interpreter.stdout + 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 + 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 + <