/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
- # 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