<commit_before>require 'minitest/autorun'
require './tennis'

describe Tennis do

  it "can be newed with two players id" do
    tennis = Tennis.new(:Foo, :Bar)
  end

  it "can get a score by a player" do
    tennis = Tennis.new(:Foo, :Bar)
    assert_equal("0 : 0"  , tennis.result)
    tennis.score_by!(:Foo)
    assert_equal("15 : 0" , tennis.result)
    tennis.score_by!(:Foo)
    assert_equal("30 : 0" , tennis.result)
    tennis.score_by!(:Bar)
    assert_equal("30 : 15", tennis.result)
    assert_equal(false    , tennis.score_by!(:someone)) 
    assert_equal("30 : 15", tennis.result)
    [:Foo, :Bar, :Bar].each { |player| tennis.score_by!(player) }
    assert_equal("Duel!", tennis.result)
    tennis.score_by!(:Foo)
    assert_equal("advantage : 40", tennis.result)
    tennis.score_by!(:Bar)
    assert_equal("Duel!", tennis.result)
    2.times { tennis.score_by!(:Bar) }
    assert_equal("Bar won!", tennis.result)  
  end

  it "can play, case 1" do
    puts :test_case1
    tennis = Tennis.new(:Foo, :Bar)
    tennis.play! do |result| 
      puts result
      :Bar
    end
    assert_equal(:Bar, tennis.winner)
  end

  it "can play , case 2 for array" do
    puts :test_case2
    tennis = Tennis.new(:F, :B)
    
    arr = [:F, :B, :F, :B, :F, :B, :F, :B, :F, :B]
    i = 0
    tennis.play! do |result|
      break if i == arr.length
      puts result
      arr[i += 1]
    end
    assert_equal(nil, tennis.winner)
        
    2.times {tennis.score_by!(:B)}
    assert_equal(:B, tennis.winner)
  end

  it "can play, case 3 for duck typing" do
    puts :test_case3
    tennis = Tennis.new(42,99)
    tennis.play! do |result| 
      puts result
      42
    end
    assert_equal(42, tennis.winner)

  end 

end
<commit_msg>polished<commit_after>require 'minitest/autorun'
require './tennis'

describe Tennis do

  it "can be newed with two players id" do
    tennis = Tennis.new(:Foo, :Bar)
  end

  it "can get a score by a player" do
    tennis = Tennis.new(:Foo, :Bar)
    assert_equal("0 : 0"  , tennis.result)
    tennis.score_by!(:Foo)
    assert_equal("15 : 0" , tennis.result)
    tennis.score_by!(:Foo)
    assert_equal("30 : 0" , tennis.result)
    tennis.score_by!(:Bar)
    assert_equal("30 : 15", tennis.result)
    assert_equal(false    , tennis.score_by!(:someone)) 
    assert_equal("30 : 15", tennis.result)
    [:Foo, :Bar, :Bar].each { |player| tennis.score_by!(player) }
    assert_equal("Duel!", tennis.result)
    tennis.score_by!(:Foo)
    assert_equal("advantage : 40", tennis.result)
    tennis.score_by!(:Bar)
    assert_equal("Duel!", tennis.result)
    2.times { tennis.score_by!(:Bar) }
    assert_equal("Bar won!", tennis.result)  
  end

  it "can play, case 1" do
    puts :test_case1
    tennis = Tennis.new(:Foo, :Bar)
    tennis.play! do |result| 
      puts result
      :Bar
    end
    assert_equal(:Bar, tennis.winner)
  end

  it "can play , case 2 for array" do
    puts :test_case2
    tennis = Tennis.new(:F, :B)
    
    arr = [:F, :B, :F, :B, :F, :B, :F, :B, :F, :B]
    i = 0
    tennis.play! do |result|
      break if i == arr.length
      puts result
      arr[i += 1]
    end
    assert_equal(nil, tennis.winner)
        
    2.times {tennis.score_by!(:B)}
    assert_equal(:B, tennis.winner)
  end

  it "can play, case 3 with int" do
    puts :test_case3
    tennis = Tennis.new(42,99)
    tennis.play! do |result| 
      puts result
      42
    end
    assert_equal(42, tennis.winner)
  end 

end

{'fraction_non_alphanumeric': 0.14298068607667916, 'fraction_numerical': 0.020755260882098586, 'mean_word_length': 2.703308431163287, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '474786', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1318, 'n_words': 323}