Sha256: 4f4445f459d8a0fdd03fc6038f65469a58b99a7c2158548d37590af5a18b8c0b

Contents?: true

Size: 693 Bytes

Versions: 33

Compression:

Stored size: 693 Bytes

Contents

require 'spec_helper'

describe '#bitcount(key [, start, end ])' do
  before do
    @key = 'mock-redis-test:bitcount'
    @redises.set(@key, 'foobar')
  end

  it 'gets the number of set bits from the key' do
    @redises.bitcount(@key).should == 26
  end

  it 'gets the number of set bits from the key in an interval' do
    @redises.bitcount(@key, 0, 1000).should == 26
    @redises.bitcount(@key, 0, 0).should == 4
    @redises.bitcount(@key, 1, 1).should == 6
    @redises.bitcount(@key, 1, -2).should == 18
  end

  it 'treats nonexistent keys as empty strings' do
    @redises.bitcount('mock-redis-test:not-found').should == 0
  end

  it_should_behave_like 'a string-only command'
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
mock_redis-0.36.0 spec/commands/bitcount_spec.rb
mock_redis-0.35.0 spec/commands/bitcount_spec.rb
mock_redis-0.34.0 spec/commands/bitcount_spec.rb
mock_redis-0.33.0 spec/commands/bitcount_spec.rb
mock_redis-0.32.0 spec/commands/bitcount_spec.rb
mock_redis-0.31.0 spec/commands/bitcount_spec.rb
mock_redis-0.30.0 spec/commands/bitcount_spec.rb
mock_redis-0.29.0 spec/commands/bitcount_spec.rb
mock_redis-0.28.0 spec/commands/bitcount_spec.rb
mock_redis-0.27.3 spec/commands/bitcount_spec.rb
mock_redis-0.27.2 spec/commands/bitcount_spec.rb
mock_redis-0.27.1 spec/commands/bitcount_spec.rb
mock_redis-0.27.0 spec/commands/bitcount_spec.rb
mock_redis-0.26.0 spec/commands/bitcount_spec.rb
mock_redis-0.25.0 spec/commands/bitcount_spec.rb
mock_redis-0.24.0 spec/commands/bitcount_spec.rb
mock_redis-0.23.0 spec/commands/bitcount_spec.rb
mock_redis-0.22.0 spec/commands/bitcount_spec.rb
mock_redis-0.21.0 spec/commands/bitcount_spec.rb
mock_redis-0.20.0 spec/commands/bitcount_spec.rb