Sha256: d8dc1b2ed38bb2502162a356aef76e7859dbf1481a2cbbff3e4e5c18480c74b2

Contents?: true

Size: 822 Bytes

Versions: 2

Compression:

Stored size: 822 Bytes

Contents

#! /usr/bin/env ruby
# coding: utf-8


require 'helper'
require "test/unit"

require "array/selectindices.rb"

#describe Array, "including items" do

class TC_Array_select_indices < Test::Unit::TestCase
  #it "should do for empty array." do
  def test_select_indices
    assert_equal([], [].select_indices{ false })
    assert_equal([], [].select_indices{ true } )

    #it "should do for array of String." do
    assert_equal([]       , %w[ a b c    ].select_indices{ false } )
    assert_equal([0,1,2]  , %w[ a b c    ].select_indices{ true }  )

    #it "should do for empty array of Integer." do
    assert_equal([]         , [0,1,2,3].select_indices{ false }     )
    assert_equal([0,1,2,3]  , [0,1,2,3].select_indices{ true }      )
    assert_equal([0,1]      , [0,1,2,3].select_indices{ |i| i < 2 } )
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
builtinextension-0.1.4 test/array/test_select_indices.rb
builtinextension-0.1.3 test/test_array_select_indices.rb