start larger tests

This commit is contained in:
Torsten Ruger
2018-04-23 14:05:37 +03:00
parent 1907574c60
commit ef5854c4df
4 changed files with 71 additions and 43 deletions

View File

@ -14,7 +14,7 @@ module Risc
@interpreter = Interpreter.new
@interpreter.start Risc.machine.risc_init
end
alias :do_setup :setup
alias :do_setup :setup
# must be after boot, but before main compile, to define method
def do_clean_compile
@ -61,11 +61,11 @@ module Risc
end
# collect the classes of all executed istructions
def all_classes
def all_classes(max = 300)
classes = []
tick = 1
begin
while true and (classes.length < 300)
while true and (classes.length < max)
cl = ticks(1).class
tick += 1
classes << cl
@ -80,11 +80,15 @@ module Risc
end
# do the setup, compile and run the input to the end
def run_all(input)
def run_input(input)
@string_input = as_main(input)
do_setup
all_classes
run_all
end
def run_all
@interpreter.tick while(@interpreter.instruction)
end
# for chaning the tests quickly output all instructions that are executed
def show_ticks
classes = all_classes