Sha256: 1dd2aad143be455cb650a34e0afd3ec112ba89410ad7fa4362c9f94b8f1ed998
Contents?: true
Size: 1.58 KB
Versions: 2
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' module NNCore describe "nn_socket" do context "given an initialized library and" do PROTOCOLS.keys.each do |protocol| context "given a supported protocol #{protocol} and address family AF_SP" do it "returns a non-zero file descriptor for the socket" do @socket = LibNanomsg.nn_socket(AF_SP, PROTOCOLS[protocol]) @socket.should == 0 LibNanomsg.nn_close(@socket) end end context "given a supported protocol #{protocol} and address family AF_SP_RAW" do if RAW_UNSUPPORTED.include?(protocol) it "returns -1 and sets nn_errno to EINVAL" do @socket = LibNanomsg.nn_socket(AF_SP_RAW, PROTOCOLS[protocol]) @socket.should == -1 LibNanomsg.nn_errno.should == EINVAL end end end end context "given an unsupported address family" do it "nn_socket returns -1 and sets nn_errno to EAFNOSUPPORT" do LibNanomsg.nn_socket(0, NN_PUB).should == -1 LibNanomsg.nn_errno.should == EAFNOSUPPORT end end context "given an unsupported protocol and a supported address family" do it "AF_SP returns -1 and sets nn_errno to EINVAL" do LibNanomsg.nn_socket(AF_SP, 0).should == -1 LibNanomsg.nn_errno.should == EINVAL end it "AF_SP_RAW returns -1 and sets nn_errno to EINVAL" do LibNanomsg.nn_socket(AF_SP_RAW, 0).should == -1 LibNanomsg.nn_errno.should == EINVAL end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nn-core-0.2.1 | spec/nn_socket_spec.rb |
nn-core-0.1.6 | spec/nn_socket_spec.rb |