<commit_before>require 'test/unit'

class Activity
  attr_reader :start
  
  def initialize(start_text, project)
    today = Time.new
    start_year, start_month, start_day = today.year, today.month, today.day
    start_hour = start_text.slice(0, 2).to_i
    start_min = start_text.slice(2, 2).to_i
    start_sec = 0
    @start = Time.new(start_year, start_month, start_day,
                      start_hour, start_min, start_sec)
  end
end


class ActivityTest < Test::Unit::TestCase

  # Test ideas
  # - start 1724
  # - start 0322
  # - start 0004
  # - start 05260655
  # - start 202506220536

  def setup
    @zero_month_full_day = '05260655'
    @full_hour_full_min = '1724'
    @zero_hour_full_min = '0322'
    @zero_hour_zero_min = '0004'
  end


  def test_new_full_hour_full_min_start_hour_set
    cut = Activity.new(@full_hour_full_min, nil)

    assert_equal(17, cut.start.hour)
  end<commit_msg>Change Activity.new to make tests green.<commit_after>require 'test/unit'

class Activity
  attr_reader :start
  
  def initialize(start_text, project)
    if start_text.size == 4
      today = Time.new
      start_year, start_month, start_day = today.year, today.month, today.day
      start_hour = start_text.slice(0, 2).to_i
      start_min = start_text.slice(2, 2).to_i
      start_sec = 0
      @start = Time.new(start_year, start_month, start_day,
                        start_hour, start_min, start_sec)
    elsif start_text.size == 8
      today = Time.new
      start_year = today.year
      start_month = start_text.slice(0, 2).to_i
      start_day = start_text.slice(2, 2).to_i
      start_hour = start_text.slice(4, 2).to_i
      start_min = start_text.slice(6, 2).to_i
      start_sec = 0
      @start = Time.new(start_year, start_month, start_day,
                        start_hour, start_min, start_sec)
      end
  end
end


class ActivityTest < Test::Unit::TestCase

  # Test ideas
  # - start 1724
  # - start 0322
  # - start 0004
  # - start 05260655
  # - start 202506220536

  def setup
    @zero_month_full_day = '05260655'
    @full_hour_full_min = '1724'
    @zero_hour_full_min = '0322'
    @zero_hour_zero_min = '0004'
  end


  def test_new_full_hour_full_min_start_hour_set
    cut = Activity.new(@full_hour_full_min, nil)

    assert_equal(17, cut.start.hour)
  end
{'fraction_non_alphanumeric': 0.09496964440589765, 'fraction_numerical': 0.055941023417172595, 'mean_word_length': 2.890387858347386, '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': '734385', 'n_tokens_mistral': 930, 'n_tokens_neox': 831, 'n_words': 172}