<commit_before>require 'rubygems'
gem 'test-unit'
require 'test/unit'
require_relative '../../Converters/week_converter'

class WeekConverterTests < Test::Unit::TestCase
  class << self
    # Startup method runs only once for each test suite
    def startup
      # test data
      @@lines = Array.new
      @@lines.push("Week 1")
      @@lines.push("Monday 2015-01-01")
      @@lines.push("- first task")
      @@lines.push("Tuesday 2015-01-02")
    end
  end

  # End of week should have at least three hyphens
  def test_is_valid_end_of_week
    result = WeekConverter.is_end_of_week("---")
    assert_equal(true, result)
  end

  def test_two_hyphens_are_not_valid_end_of_week
    result = WeekConverter.is_end_of_week("--")
    assert_equal(false, result)
  end

  def test_convert_lines_to_week_should_return_week_object
    weekConverter = WeekConverter.new(@@lines)
    week = weekConverter.convert_lines_to_week

    assert(week.is_a?(Week))
  end

  # Week should have name, days and actions in day
  def test_convert_lines_to_week_should_return_week_with_proper_date
    weekConverter = WeekConverter.new(@@lines)
    week = weekConverter.convert_lines_to_week

    assert_equal("Week 1", week.name)
    assert_equal(2, week.days.length)
    assert_equal(1, week.days[0].actions)
  end

  def test_parse_week_should_return_proper_data
    weekConverter = WeekConverter.new(@@lines)
    parsed_week = weekConverter.parse_week

    assert_equal("Week 1", weekConverter.week.name)
    assert(parsed_week.is_a?(Hash))
    assert_equal(2, parsed_week.keys.length)
  end
end<commit_msg>Adds test for number of actions in a day<commit_after>require 'rubygems'
gem 'test-unit'
require 'test/unit'
require_relative '../../Converters/week_converter'

class WeekConverterTests < Test::Unit::TestCase
  class << self
    # Startup method runs only once for each test suite
    def startup
      # test data
      @@lines = Array.new
      @@lines.push("Week 1")
      @@lines.push("Monday 2015-01-01")
      @@lines.push("- first task")
      @@lines.push("- second task")
      @@lines.push("Tuesday 2015-01-02")
    end
  end

  # End of week should have at least three hyphens
  def test_is_valid_end_of_week
    result = WeekConverter.is_end_of_week("---")
    assert_equal(true, result)
  end

  def test_two_hyphens_are_not_valid_end_of_week
    result = WeekConverter.is_end_of_week("--")
    assert_equal(false, result)
  end

  def test_convert_lines_to_week_should_return_week_object
    weekConverter = WeekConverter.new(@@lines)
    week = weekConverter.convert_lines_to_week

    assert(week.is_a?(Week))
  end

  # Week should have name, days and actions in day
  def test_convert_lines_to_week_should_return_week_with_proper_date
    weekConverter = WeekConverter.new(@@lines)
    week = weekConverter.convert_lines_to_week

    assert_equal("Week 1", week.name)
    assert_equal(2, week.days.length)
    assert_equal(1, week.days[0].actions)
  end

  def test_parse_week_should_return_proper_data
    weekConverter = WeekConverter.new(@@lines)
    parsed_week = weekConverter.parse_week

    assert_equal("Week 1", weekConverter.week.name)
    assert(parsed_week.is_a?(Hash))
    assert_equal(2, parsed_week.keys.length)

    # we have two actions on first day
    assert_equal(2, parsed_week[parsed_week.keys[0]].length)
  end
end
{'fraction_non_alphanumeric': 0.09982068141063957, 'fraction_numerical': 0.01434548714883443, 'mean_word_length': 3.9585185185185185, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4643258', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1098, 'n_words': 233}