Sha256: f6d331c95d71f6be7bf32efc5dc608eba14b9f2dea16919720df3609dc2e49ba

Contents?: true

Size: 806 Bytes

Versions: 5

Compression:

Stored size: 806 Bytes

Contents

# encoding: binary
shared_examples "key equality" do
  context "equality" do
    it "equal keys are equal" do
      (described_class.new(key_bytes) == key).should be true
    end
    it "equal keys are equal to the string" do
      (key == key_bytes).should be true
    end
    it "keys are not equal to zero" do
      (key == RbNaCl::Util.zeros(32)).should be false
    end
    it "keys are not equal to another key" do
      (key == other_key).should be false
    end
  end

  context "lexicographic sorting" do
    it "can be compared lexicographically to a key smaller than it" do
      (key > RbNaCl::Util.zeros(32)).should be true
    end
    it "can be compared lexicographically to a key larger than it" do
      (described_class.new(RbNaCl::Util.zeros(32)) < key).should be true
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rbnacl-3.1.0 spec/shared/key_equality.rb
rbnacl-3.0.1 spec/shared/key_equality.rb
rbnacl-3.0.0 spec/shared/key_equality.rb
rbnacl-2.0.0 spec/shared/key_equality.rb
rbnacl-2.0.0.pre spec/shared/key_equality.rb