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.19.0 spec/commands/bitcount_spec.rb
mock_redis-0.18.0 spec/commands/bitcount_spec.rb
mock_redis-0.17.3 spec/commands/bitcount_spec.rb
mock_redis-0.17.2 spec/commands/bitcount_spec.rb
mock_redis-0.17.1 spec/commands/bitcount_spec.rb
mock_redis-0.17.0 spec/commands/bitcount_spec.rb
mock_redis-0.16.1 spec/commands/bitcount_spec.rb
mock_redis-0.16.0 spec/commands/bitcount_spec.rb
mock_redis-0.15.4 spec/commands/bitcount_spec.rb
mock_redis-0.15.3 spec/commands/bitcount_spec.rb
mock_redis-0.15.2 spec/commands/bitcount_spec.rb
mock_redis-0.15.1 spec/commands/bitcount_spec.rb
mock_redis-0.15.0 spec/commands/bitcount_spec.rb