Sha256: 0ed4be0f5f7ea261438e67c3060a8ccb546502e3a8dbfb1da6d8ab59a152a392

Contents?: true

Size: 556 Bytes

Versions: 171

Compression:

Stored size: 556 Bytes

Contents

require 'test_helper'
require 'tins/xt'

module Tins
  class CountByTest < Test::Unit::TestCase

    def test_count_by
      assert_equal 0, [].count_by { |x| x % 2 == 0 }
      assert_equal 0, [ 1 ].count_by { |x| x % 2 == 0 }
      assert_equal 1, [ 1 ].count_by { |x| x % 2 == 1 }
      assert_equal 1, [ 1, 2 ].count_by { |x| x % 2 == 0 }
      assert_equal 1, [ 1, 2 ].count_by { |x| x % 2 == 1 }
      assert_equal 2, [ 1, 2, 3, 4, 5 ].count_by { |x| x % 2 == 0 }
      assert_equal 3, [ 1, 2, 3, 4, 5 ].count_by { |x| x % 2 == 1 }
    end
  end
end

Version data entries

171 entries across 153 versions & 9 rubygems

Version Path
tins-1.38.0 tests/count_by_test.rb
tins-1.37.1 tests/count_by_test.rb
tins-1.37.0 tests/count_by_test.rb
tins-1.36.1 tests/count_by_test.rb
tins-1.36.0 tests/count_by_test.rb
tins-1.35.0 tests/count_by_test.rb
tins-1.34.0 tests/count_by_test.rb
tins-1.33.0 tests/count_by_test.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/count_by_test.rb
tins-1.32.1 tests/count_by_test.rb
tins-1.32.0 tests/count_by_test.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/count_by_test.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/tins-1.31.1/tests/count_by_test.rb
tins-1.31.1 tests/count_by_test.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/tins-1.31.0/tests/count_by_test.rb
tins-1.31.0 tests/count_by_test.rb
tins-1.30.0 tests/count_by_test.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/tests/count_by_test.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/count_by_test.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/tins-1.29.1/tests/count_by_test.rb