Sha256: c46e40995559bf22348da3df4d7cc5a5c3723b9f246a5e8434e9852e1da62b95

Contents?: true

Size: 1.32 KB

Versions: 54

Compression:

Stored size: 1.32 KB

Contents

# encoding: UTF-8

require File.expand_path("./helper", File.dirname(__FILE__))

setup do
  init Redis.new(OPTIONS)
end

load './test/lint/sets.rb'

test "SMOVE" do |r|
  r.sadd "foo", "s1"
  r.sadd "bar", "s2"

  assert r.smove("foo", "bar", "s1")
  assert r.sismember("bar", "s1")
end

test "SINTER" do |r|
  r.sadd "foo", "s1"
  r.sadd "foo", "s2"
  r.sadd "bar", "s2"

  assert ["s2"] == r.sinter("foo", "bar")
end

test "SINTERSTORE" do |r|
  r.sadd "foo", "s1"
  r.sadd "foo", "s2"
  r.sadd "bar", "s2"

  r.sinterstore("baz", "foo", "bar")

  assert ["s2"] == r.smembers("baz")
end

test "SUNION" do |r|
  r.sadd "foo", "s1"
  r.sadd "foo", "s2"
  r.sadd "bar", "s2"
  r.sadd "bar", "s3"

  assert ["s1", "s2", "s3"] == r.sunion("foo", "bar").sort
end

test "SUNIONSTORE" do |r|
  r.sadd "foo", "s1"
  r.sadd "foo", "s2"
  r.sadd "bar", "s2"
  r.sadd "bar", "s3"

  r.sunionstore("baz", "foo", "bar")

  assert ["s1", "s2", "s3"] == r.smembers("baz").sort
end

test "SDIFF" do |r|
  r.sadd "foo", "s1"
  r.sadd "foo", "s2"
  r.sadd "bar", "s2"
  r.sadd "bar", "s3"

  assert ["s1"] == r.sdiff("foo", "bar")
  assert ["s3"] == r.sdiff("bar", "foo")
end

test "SDIFFSTORE" do |r|
  r.sadd "foo", "s1"
  r.sadd "foo", "s2"
  r.sadd "bar", "s2"
  r.sadd "bar", "s3"

  r.sdiffstore("baz", "foo", "bar")

  assert ["s1"] == r.smembers("baz")
end


Version data entries

54 entries across 54 versions & 7 rubygems

Version Path
abaci-0.3.0 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.7.5 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.7.4 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.7.3 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.7.2 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.7.1 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.7.0 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.9 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.8 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.7 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.6 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.5 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.4 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.3 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.2 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.1 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.6.0 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.5.17 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.5.16 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb
classiccms-0.5.15 vendor/bundle/gems/redis-2.2.2/test/commands_on_sets_test.rb