<commit_before>class ListExtensionsTest < Test::Unit::TestCase
  def test_empty_q
    cls, = compile(<<-EOF)
      x = []
      puts x.empty?
    EOF
    assert_run_output("true\n", cls)
  end

  def test_bracket_getter
    cls, = compile(<<-EOF)
      x = [1,2]
      puts x[0]
    EOF
    assert_run_output("1\n", cls)
  end

  def test_bracket_assignment
    cls, = compile(<<-EOF)
      import java.util.ArrayList
      x = ArrayList.new
      x[0]= "2"
      puts x
    EOF
    assert_run_output("[2]\n", cls)
  end
  
  def test_sort_with_comparator
    cls, = compile(<<-EOF)
      puts ([3,1,2].sort do |o0:Comparable,o1:Comparable|
        -o0.compareTo(o1)
      end)
    EOF
    assert_run_output("[3, 2, 1]\n", cls)
  end

  def test_sort_with_comparator2
    cls, = compile(<<-EOF)
      puts ([3,1,2].sort! do |o0:Comparable,o1:Comparable|
        -o0.compareTo(o1)
      end)
    EOF
    assert_run_output("[3, 2, 1]\n", cls)
  end

  def test_sort_without_comparator
    cls, = compile(<<-EOF)
      puts [5,1,3].sort
    EOF
    assert_run_output("[1, 3, 5]\n", cls)
  end

  def test_first<commit_msg>Choose more precise test names.<commit_after>class ListExtensionsTest < Test::Unit::TestCase
  def test_empty_q
    cls, = compile(<<-EOF)
      x = []
      puts x.empty?
    EOF
    assert_run_output("true\n", cls)
  end

  def test_bracket_getter
    cls, = compile(<<-EOF)
      x = [1,2]
      puts x[0]
    EOF
    assert_run_output("1\n", cls)
  end

  def test_bracket_assignment
    cls, = compile(<<-EOF)
      import java.util.ArrayList
      x = ArrayList.new
      x[0]= "2"
      puts x
    EOF
    assert_run_output("[2]\n", cls)
  end
  
  def test_sort_with_block
    cls, = compile(<<-EOF)
      puts ([3,1,2].sort do |o0:Comparable,o1:Comparable|
        -o0.compareTo(o1)
      end)
    EOF
    assert_run_output("[3, 2, 1]\n", cls)
  end

  def test_sort_bang_with_block
    cls, = compile(<<-EOF)
      puts ([3,1,2].sort! do |o0:Comparable,o1:Comparable|
        -o0.compareTo(o1)
      end)
    EOF
    assert_run_output("[3, 2, 1]\n", cls)
  end

  def test_sort_without_comparator
    cls, = compile(<<-EOF)
      puts [5,1,3].sort
    EOF
    assert_run_output("[1, 3, 5]\n", cls)
  end

  def test_first
{'fraction_non_alphanumeric': 0.1408888888888889, 'fraction_numerical': 0.029777777777777778, 'mean_word_length': 2.4737654320987654, 'pattern_counts': {'":': 0, '<': 29, '<?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': '5655395', 'n_tokens_mistral': 916, 'n_tokens_neox': 908, 'n_words': 179}