PageRenderTime 30ms CodeModel.GetById 19ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/bundle/jruby/2.1/gems/rbnacl-3.0.1/spec/shared/key_equality.rb

https://github.com/delowong/logstash
Ruby | 26 lines | 24 code | 1 blank | 1 comment | 4 complexity | 9e73071180f89fdac3071cfdd94d6808 MD5 | raw file
 1# encoding: binary
 2shared_examples "key equality" do
 3  context "equality" do
 4    it "equal keys are equal" do
 5      (described_class.new(key_bytes) == key).should be true
 6    end
 7    it "equal keys are equal to the string" do
 8      (key == key_bytes).should be true
 9    end
10    it "keys are not equal to zero" do
11      (key == RbNaCl::Util.zeros(32)).should be false
12    end
13    it "keys are not equal to another key" do
14      (key == other_key).should be false
15    end
16  end
17
18  context "lexicographic sorting" do
19    it "can be compared lexicographically to a key smaller than it" do
20      (key > RbNaCl::Util.zeros(32)).should be true
21    end
22    it "can be compared lexicographically to a key larger than it" do
23      (described_class.new(RbNaCl::Util.zeros(32)) < key).should be true
24    end
25  end
26end