A little work on test times

They have been rising of late, installer reporter to check 8and keep checking)
tweaking of cli parameters 
removed redundant interpreter tests
This commit is contained in:
Torsten Rüger 2019-09-18 13:10:55 +03:00
parent e56db0a3ac
commit f13e8b3bd7
12 changed files with 32 additions and 69 deletions

View File

@ -9,6 +9,8 @@ gem "rake"
gem "rx-file" , git: "https://github.com/ruby-x/rx-file"
#gem "rx-file" , path: "../rx-file"
group :test do
# reporter and parallel dont work together
# gem "minitest-reporters"
gem "minitest-parallel_fork"
gem "codeclimate-test-reporter" , require: false
gem "simplecov"

View File

@ -14,7 +14,9 @@ PATH
GEM
remote: https://rubygems.org/
specs:
ansi (1.5.0)
ast (2.4.0)
builder (3.2.3)
codeclimate-test-reporter (1.0.9)
simplecov (<= 0.13)
coderay (1.1.2)
@ -49,6 +51,11 @@ GEM
minitest (~> 5)
minitest-parallel_fork (1.1.2)
minitest-profile (0.0.2)
minitest-reporters (1.3.8)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
nenv (0.3.0)
notiffany (0.1.3)
nenv (~> 0.1)
@ -63,6 +70,7 @@ GEM
rb-inotify (0.10.0)
ffi (~> 1.0)
rb-readline (0.5.5)
ruby-progressbar (1.10.1)
ruby_dep (1.5.0)
shellany (0.0.1)
simplecov (0.13.0)
@ -84,6 +92,7 @@ DEPENDENCIES
minitest-fail-fast
minitest-parallel_fork
minitest-profile
minitest-reporters
rake
rb-readline
rubyx!

View File

@ -1,7 +1,8 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme
# can't put in helper or it will run (and fail) with parallel
#require "minitest/reporters"
#Minitest::Reporters.use!( Minitest::Reporters::MeanTimeReporter.new)
guard :minitest , all_on_start: false do # with Minitest::Unit
guard :minitest ,:cli => "--profile", all_on_start: false do # with Minitest::Unit
# if any test file changes, run that test
watch(%r{^test/(.*)\/?test_(.*)\.rb$})

View File

@ -4,7 +4,7 @@ require "risc/interpreter"
class RubyXC < Thor
class_option :integers , type: :numeric
class_option :mesages , type: :numeric
class_option :messages , type: :numeric
class_option :elf , type: :boolean
class_option :preload , type: :boolean

View File

@ -16,9 +16,6 @@ require "minitest/color"
require "minitest/autorun"
require "minitest/fail_fast" unless ENV["TEST_ALL"]
require 'minitest/profile'
#require "minitest/reporters"
#Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test'))

View File

@ -9,7 +9,7 @@ module Risc
@string_input = as_main("return 5 + 5")
super
end
#FIXME should be mom macro test, no need to interpret
def test_chain
#show_main_ticks # get output of what is
check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5
@ -28,23 +28,23 @@ module Risc
def base_ticks(num)
main_ticks(14 + num)
end
def test_base
def est_base
cal = main_ticks( 14 )
assert_equal FunctionCall , cal.class
end
def test_load_receiver
def est_load_receiver
sl = base_ticks( 8 )
assert_slot_to_reg( sl , :r0 , 2 , :r2)
end
def test_reduce_receiver
def est_reduce_receiver
sl = base_ticks( 9 )
assert_slot_to_reg( sl , :r2 , 2 , :r2)
end
def test_slot_args #load args from message
def est_slot_args #load args from message
sl = base_ticks( 10 )
assert_slot_to_reg( sl , :r0 , 9 , :r3)
end
def test_reduce_arg
def est_reduce_arg
sl = base_ticks( 11 )
assert_slot_to_reg( sl , :r3 , 2 , :r3)
assert_equal 5 , @interpreter.get_register(:r3)
@ -66,13 +66,5 @@ module Risc
int = base_ticks( 14 )
assert_reg_to_slot( int , :r1 , :r0 , 5)
end
def test_move_fix_to_result
sl = base_ticks( 15 )
assert_slot_to_reg( sl , :r0 , 5 , :r2)
end
def test_move_fix_to_result
sl = base_ticks( 16 )
assert_reg_to_slot( sl , :r2 , :r0 , 5)
end
end
end

View File

@ -17,58 +17,16 @@ module Risc
assert_equal 5 , get_return
end
def test_call_main
def est_call_main
call_ins = ticks(main_at)
assert_equal FunctionCall , call_ins.class
assert :main , call_ins.method.name
end
def test_load_5
load_ins = main_ticks(1)
assert_load load_ins , Parfait::Integer
assert_equal 5 , load_ins.constant.value
end
def test_store_ret_val
sl = main_ticks( 2 )
assert_reg_to_slot( sl , :r1 , :r0 , 5)
end
def test_branch
sl = main_ticks( 3 )
assert_equal Branch , sl.class
assert_equal "return_label" , sl.label.name
end
def test_load_ret
sl = main_ticks( 4 )
assert_slot_to_reg( sl , :r0 , 5 , :r1)
end
def test_load_caller
sl = main_ticks( 5 )
assert_slot_to_reg( sl , :r0 , 6 , :r2)
end
def test_load_caller_ret
sl = main_ticks( 6 )
assert_reg_to_slot( sl , :r1 , :r2 , 5)
end
def test_load_ret_add
sl = main_ticks( 7 )
assert_slot_to_reg( sl , :r0 , 4 , :r3)
end
def test_reduce_addedd
sl = main_ticks( 8 )
assert_slot_to_reg( sl , :r3 , 2 , :r3)
end
def test_load_next_message
sl = main_ticks( 9 )
assert_slot_to_reg( sl , :r0 , 6 , :r0)
end
def test_function_return
ret = main_ticks(10)
assert_equal FunctionReturn , ret.class
link = @interpreter.get_register( ret.register )
assert_equal ::Integer , link.class
end
def test_transfer
transfer = main_ticks(11)
assert_equal Transfer , transfer.class
end
end
end

View File

@ -1,7 +1,7 @@
require_relative "../helper"
module Risc
class InterpreterWhileSimle < MiniTest::Test
class InterpreterWhileSimple < MiniTest::Test
include Ticker
def setup

View File

@ -5,7 +5,8 @@ module RubyX
class TestRubyXCliCompile < MiniTest::Test
def test_compile
assert_output(/compiling/) {RubyXC.start(["compile" , "--preload","test/mains/source/add__4.rb"])}
assert_output(/compiling/) {RubyXC.start(["compile" , "--preload",
"--integers=50","--messages=50","test/mains/source/add__4.rb"])}
end
end
end

View File

@ -5,7 +5,8 @@ module RubyX
class TestRubyXCliExecute < MiniTest::Test
def test_execute
assert_output(/Running/) {RubyXC.start(["execute" ,"--preload", "test/mains/source/add__4.rb"])}
assert_output(/Running/) {RubyXC.start(["execute" ,"--preload",
"--integers=50","--messages=50" , "test/mains/source/add__4.rb"])}
end
end
end

View File

@ -5,7 +5,8 @@ module RubyX
class TestRubyXCliInterpret < MiniTest::Test
def test_interpret
assert_output(/interpreting/) {RubyXC.start(["interpret" ,"--preload", "test/mains/source/add__4.rb"])}
assert_output(/interpreting/) {RubyXC.start(["interpret" ,"--preload",
"--integers=50","--messages=50" , "test/mains/source/add__4.rb"])}
end
end
end

View File

@ -5,7 +5,8 @@ module RubyX
class TestRubyXCliStats < MiniTest::Test
def test_stats
out, err = capture_io {RubyXC.start(["stats" ,"--preload", "test/mains/source/add__4.rb"])}
out, err = capture_io {RubyXC.start(["stats" ,"--preload",
"--integers=50","--messages=50", "test/mains/source/add__4.rb"])}
assert out.include?("Space") , out
assert out.include?("Total") , out
assert out.include?("Objects=") , out