From 646797301ed7eb5b199ebf2bf66224a8a4eac967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20R=C3=BCger?= Date: Fri, 6 Sep 2019 20:59:14 +0300 Subject: [PATCH] rearrange test helpers for later --- test/rubyx/helper.rb | 28 ++++++++++++++++++++++++++ test/rubyx/parfait/helper.rb | 13 ------------ test/rubyx/parfait/test_data_object.rb | 2 +- test/rubyx/parfait/test_integer.rb | 2 +- test/rubyx/parfait/test_object.rb | 2 +- test/rubyx/rt_parfait/rt_helper.rb | 6 ++++++ 6 files changed, 37 insertions(+), 16 deletions(-) delete mode 100644 test/rubyx/parfait/helper.rb create mode 100644 test/rubyx/rt_parfait/rt_helper.rb diff --git a/test/rubyx/helper.rb b/test/rubyx/helper.rb index ae58aa8b..04a016a2 100644 --- a/test/rubyx/helper.rb +++ b/test/rubyx/helper.rb @@ -20,6 +20,34 @@ module RubyX assert itest itest end + end + module ParfaitHelper + + def load_parfait(file) + File.read File.expand_path("../../../lib/parfait/#{file}.rb",__FILE__) + end + def load_parfait_test(file) + File.read File.expand_path("../../parfait/test_#{file}.rb",__FILE__) + end + def compiler + RubyXCompiler.new(RubyX.default_test_options) + end + + def run_input + linker = compiler.ruby_to_binary(@input , :interpreter) + @interpreter = Risc::Interpreter.new(linker) + @interpreter.start_program + run_all + end + + def run_all + while(@interpreter.instruction) + @interpreter.tick + #puts @interpreter.instruction + end + @interpreter.clock + end end + end diff --git a/test/rubyx/parfait/helper.rb b/test/rubyx/parfait/helper.rb deleted file mode 100644 index 7ca6d99d..00000000 --- a/test/rubyx/parfait/helper.rb +++ /dev/null @@ -1,13 +0,0 @@ -require_relative "../helper" - -module RubyX - module ParfaitHelper - - def load_parfait(file) - File.read File.expand_path("../../../../lib/parfait/#{file}.rb",__FILE__) - end - def compiler - RubyXCompiler.new(RubyX.default_test_options) - end - end -end diff --git a/test/rubyx/parfait/test_data_object.rb b/test/rubyx/parfait/test_data_object.rb index 759e83e2..6d2f7c4b 100644 --- a/test/rubyx/parfait/test_data_object.rb +++ b/test/rubyx/parfait/test_data_object.rb @@ -1,4 +1,4 @@ -require_relative "helper" +require_relative "../helper" module RubyX diff --git a/test/rubyx/parfait/test_integer.rb b/test/rubyx/parfait/test_integer.rb index f22b2ba0..b1d73343 100644 --- a/test/rubyx/parfait/test_integer.rb +++ b/test/rubyx/parfait/test_integer.rb @@ -1,4 +1,4 @@ -require_relative "helper" +require_relative "../helper" module RubyX diff --git a/test/rubyx/parfait/test_object.rb b/test/rubyx/parfait/test_object.rb index 9961f30a..67adb072 100644 --- a/test/rubyx/parfait/test_object.rb +++ b/test/rubyx/parfait/test_object.rb @@ -1,4 +1,4 @@ -require_relative "helper" +require_relative "../helper" module RubyX diff --git a/test/rubyx/rt_parfait/rt_helper.rb b/test/rubyx/rt_parfait/rt_helper.rb new file mode 100644 index 00000000..a9f6062b --- /dev/null +++ b/test/rubyx/rt_parfait/rt_helper.rb @@ -0,0 +1,6 @@ +require_relative "../helper" + +module RubyX + module Helper + end +end