<commit_before>require_relative '../../helper'


module Statements

  def check
    machine = Register.machine
    machine.boot unless machine.booted
    machine.parse_and_compile @string_input
    produced = Register.machine.space.get_main.instructions
    assert @expect , "No output given"
    #assert_equal @expect.length ,  produced.instructions.length , "instructions length #{produced.instructions.to_ac}"
    compare_instructions produced , @expect
    produced
  end

  def compare_instructions instruction , expect
    index = 0
    begin
      should = expect[index]
      assert should , "No instruction at #{index}"
      assert_equal instruction.class , should , "Expected at #{index+1}"
      index += 1
      instruction = instruction.next
    end while( instruction )
  end


end<commit_msg>let helper output correct version in case of error<commit_after>require_relative '../../helper'


module Statements

  def check
    machine = Register.machine
    machine.boot unless machine.booted
    machine.parse_and_compile @string_input
    produced = Register.machine.space.get_main.instructions
    assert @expect , "No output given"
    #assert_equal @expect.length ,  produced.instructions.length , "instructions length #{produced.instructions.to_ac}"
    compare_instructions produced , @expect
    produced
  end

  def compare_instructions instruction , expect
    index = 0
    start = instruction
    begin
      should = expect[index]
      assert should , "No instruction at #{index}"
      assert_equal instruction.class , should , "Expected at #{index+1}\n#{should(start)}"
      index += 1
      instruction = instruction.next
    end while( instruction )
  end
  def should start
    str = start.to_ac.to_s
    str.gsub!("Register::","")
    ret = ""
    str.split(",").each_slice(7).each do |line|
      ret += "              " + line.join(",") + " ,\n"
    end
    ret
  end
end
{'fraction_non_alphanumeric': 0.09848088004190676, 'fraction_numerical': 0.003666841278156103, 'mean_word_length': 3.10752688172043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '954643', 'n_tokens_mistral': 535, 'n_tokens_neox': 526, 'n_words': 147}