Sha256: 1fd4ba5c93a7c4d05de7451ca625d3b36f2325bc5175653f19a98cb26bc4ebce

Contents?: true

Size: 864 Bytes

Versions: 1

Compression:

Stored size: 864 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

1 entries across 1 versions & 1 rubygems

Version Path
builtinextension-0.1.2 test/test_array_select_indices.rb