<commit_before>require_relative 'test_base'

class TrafficLightTest < TestBase

  def self.hex_prefix
    '332'
  end

  def traffic_light
    external.traffic_light
  end

  # - - - - - - - - - - - - - - - -

  test '6CC',
  'block is used to populate the cache once only' do
    @count = 0
    5.times {
      ragger = traffic_light.rag_lambda('gcc_assert') { @count += 1; eval(purple) }
      assert_equal :purple, ragger.call('stdout','stderr',status=23)
    }
    assert_equal 1, @count
  end

  # - - - - - - - - - - - - - - - -

  def purple
    <<~RUBY
    lambda { |stdout, stderr, status|
      return :purple
    }
    RUBY
  end

end<commit_msg>refactoring; simplify test<commit_after>require_relative 'test_base'

class TrafficLightTest < TestBase

  def self.hex_prefix
    '332'
  end

  def traffic_light
    external.traffic_light
  end

  # - - - - - - - - - - - - - - - -

  test '6CC',
  'block is used to populate the cache once only' do
    count = 0
    5.times {
      ragger = traffic_light.rag_lambda('gcc_assert') { count += 1; eval(purple) }
      assert_equal :purple, ragger.call('stdout','stderr',status=23)
    }
    assert_equal 1, count
  end

  # - - - - - - - - - - - - - - - -

  def purple
    <<~RUBY
    lambda { |stdout, stderr, status|
      return :purple
    }
    RUBY
  end

end
{'fraction_non_alphanumeric': 0.13746223564954682, 'fraction_numerical': 0.015105740181268883, 'mean_word_length': 1.9909706546275394, 'pattern_counts': {'":': 0, '<': 9, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7466627', 'n_tokens_mistral': 510, 'n_tokens_neox': 474, 'n_words': 105}