<commit_before>#!/usr/bin/env ruby

require_relative 'languages_test_base'
require_relative 'one_language_checker'

class AllLanguagesTests < LanguagesTestBase

  def setup
    `rm -rf #{root_path}test/cyberdojo/katas/*`
  end

  def root_path
    File.dirname(__FILE__) + '/../../'
  end

  test 'red-amber-green initial 6*9 state' do
    return if !Docker.installed?
    verbose = false
    checker = OneLanguageChecker.new(root_path,verbose)
    results = {}
    dirs = Dir.glob("#{root_path}languages/*/manifest.json")
    languages = dirs.map{|file| File.dirname(file).split('/')[-1] }
    languages.sort.each do |language|
      rag = checker.check(language)
      results[language] = rag if !rag.nil?
    end
    expected = ['red','amber','green']
    fails  = results.select{|language,rag| rag != expected }
    assert fails == {}, fails.inspect
  end

end<commit_msg>Docker command has to have absolute path in test/languages<commit_after>#!/usr/bin/env ruby

require_relative 'languages_test_base'
require_relative 'one_language_checker'

class AllLanguagesTests < LanguagesTestBase

  def setup
    `rm -rf #{root_path}test/cyberdojo/katas/*`
  end

  def root_path
    File.absolute_path(File.dirname(__FILE__) + '/../../') + '/'
  end

  test 'red-amber-green initial 6*9 state' do
    return if !Docker.installed?
    verbose = false
    checker = OneLanguageChecker.new(root_path,verbose)
    results = {}
    dirs = Dir.glob("#{root_path}languages/*/manifest.json")
    languages = dirs.map{|file| File.dirname(file).split('/')[-1] }
    languages.sort.each do |language|
      rag = checker.check(language)
      results[language] = rag if !rag.nil?
    end
    expected = ['red','amber','green']
    fails  = results.select{|language,rag| rag != expected }
    assert fails == {}, fails.inspect
  end

end
{'fraction_non_alphanumeric': 0.14042786615469008, 'fraction_numerical': 0.0032912781130005485, 'mean_word_length': 3.56, 'pattern_counts': {'":': 0, '<': 5, '<?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': '913951', 'n_tokens_mistral': 614, 'n_tokens_neox': 599, 'n_words': 125}