Sha256: fb05237107d7a517685a92037a0a4b41d4c82d8a24bd5724b1b460d2cab4fb0b

Contents?: true

Size: 824 Bytes

Versions: 4

Compression:

Stored size: 824 Bytes

Contents

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbnacl-3.4.0 spec/shared/key_equality.rb
rbnacl-3.3.0 spec/shared/key_equality.rb
rbnacl-3.2.0 spec/shared/key_equality.rb
rbnacl-3.1.2 spec/shared/key_equality.rb