teeworlds_network/spec/01_array_spec.rb
2022-11-05 17:48:47 +01:00

15 lines
431 B
Ruby

# frozen_string_literal: true
require_relative '../lib/array'
describe 'Array', :array do
context 'Simple groups' do
it 'Should do groups of two' do
expect((1..10).to_a.groups_of(2)).to eq([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]])
end
it 'Should create one group if the input is less than the group size' do
expect((1..10).to_a.groups_of(20)).to eq([[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]])
end
end
end