<commit_before>$LOAD_PATH << File.expand_path( File.dirname(__FILE__) + '/../lib' )
require 'coveralls'
Coveralls.wear!
require 'test/unit'
require 'go'

class GoUnit < Test::Unit::TestCase

  def test_threadpool_growing
    puts "Running Threadpool Growth Tests"
    Go::Config.create(5)

    assert_equal(Go::Config.get.thread_pool.max, 5)
    assert_equal(Go::Config.get.max_thread_count, 5)
    assert_equal(Go::Config.get.thread_pool.workers, 0)

    fut1 = go { puts "Testing 1 Routine" }
    fut2 = go { puts "Testing 2 Routines" }

    assert_equal(Go::Config.get.thread_pool.workers, 2)

    10.times do
      go { sleep 1 }
    end

    fut1.wait
    fut2.wait

    puts Go::Config.get.thread_pool.status
    assert_equal(Go::Config.get.thread_pool.workers, 5)
    puts "Threadpool Growth Tests Complete"
  end

  def test_threadpool_static
    puts "Running Threadpool Static Size Tests"
    Go::Config.create(5, false)
    assert_equal(Go::Config.get.thread_pool.max, 5)
    assert_equal(Go::Config.get.thread_pool.workers, 5)

    fut1 = go { puts "Testing 1 Routine" }
    fut2 = go { puts "Testing 2 Routines" }

    assert_equal(Go::Config.get.thread_pool.workers, 5)

    10.times do
      go { sleep 1 }
    end

    fut1.wait
    fut2.wait

    assert_equal(Go::Config.get.thread_pool.workers, 5)
    puts Go::Config.get.thread_pool.status
    puts "Threadpool Static Tests Complete"
  end
<commit_msg>Narrow out coverage to 100%<commit_after>$LOAD_PATH << File.expand_path( File.dirname(__FILE__) + '/../lib' )
require 'coveralls'
Coveralls.wear!
require 'test/unit'
require 'go'

class GoUnit < Test::Unit::TestCase

  def test_threadpool_growing
    puts "Running Threadpool Growth Tests"
    Go::Config.create(5)

    assert_equal(Go::Config.get.thread_pool.max, 5)
    assert_equal(Go::Config.get.max_thread_count, 5)
    assert_equal(Go::Config.get.thread_pool.workers, 0)

    fut1 = go { puts "Testing 1 Routine" }
    fut2 = go { puts "Testing 2 Routines" }

    assert_equal(Go::Config.get.thread_pool.workers, 2)

    10.times do
      go { sleep 1 }
    end

    fut1.wait
    fut2.wait

    puts Go::Config.get.thread_pool.status
    assert_equal(Go::Config.get.thread_pool.workers, 5)
    Go::Config.get.thread_pool.shutdown
    assert_equal(Go::Config.get.thread_pool.running?, false)
    puts "Threadpool Growth Tests Complete"
  end

  def test_threadpool_static
    puts "Running Threadpool Static Size Tests"
    Go::Config.create(5, false)
    assert_equal(Go::Config.get.thread_pool.max, 5)
    assert_equal(Go::Config.get.thread_pool.workers, 5)

    fut1 = go { puts "Testing 1 Routine" }
    fut2 = go { puts "Testing 2 Routines" }

    assert_equal(Go::Config.get.thread_pool.workers, 5)

    10.times do
      go { sleep 1 }
    end

    fut1.wait
    fut2.wait

    assert_equal(Go::Config.get.thread_pool.workers, 5)
    puts Go::Config.get.thread_pool.status
    puts "Threadpool Static Tests Complete"
  end

{'fraction_non_alphanumeric': 0.11531958065607034, 'fraction_numerical': 0.020629015894487658, 'mean_word_length': 3.4149253731343285, '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': '5164214', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1022, 'n_words': 219}