Sha256: 5098e4788d31e3e0b36c83284784b62ed3bfaa3848e55beb3da1117063019af9

Contents?: true

Size: 855 Bytes

Versions: 10

Compression:

Stored size: 855 Bytes

Contents

# encoding: binary
# frozen_string_literal: true

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

10 entries across 10 versions & 1 rubygems

Version Path
rbnacl-7.1.1 spec/shared/key_equality.rb
rbnacl-7.1.0 spec/shared/key_equality.rb
rbnacl-7.0.0 spec/shared/key_equality.rb
rbnacl-6.0.1 spec/shared/key_equality.rb
rbnacl-6.0.0 spec/shared/key_equality.rb
rbnacl-5.0.0 spec/shared/key_equality.rb
rbnacl-4.0.2 spec/shared/key_equality.rb
rbnacl-4.0.1 spec/shared/key_equality.rb
rbnacl-4.0.0 spec/shared/key_equality.rb
rbnacl-4.0.0.pre spec/shared/key_equality.rb