/
06.t
56 lines (37 loc) · 1.17 KB
/
06.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env perl6
use v6;
use lib 'lib';
use Test;
use Local::Test;
say "tsting get/set scket options";
BEGIN %*ENV<PERL6_TEST_DIE_ON_FAIL> = 0;
say "Setting and getting socket options" ;
use-ok 'Net::ZMQ::Socket' , 'Module Socket can load';
use Net::ZMQ::V4::Constants;
use Net::ZMQ::V4::LowLevel;
use Net::ZMQ::Error;
use Net::ZMQ::Context;
use Net::ZMQ::Socket;
my $ctx = Context.new:throw-everything;
my $s1 = Socket.new($ctx, :pair, :throw-everything);
my $s2 = Socket.new($ctx, :pair, :throw-everything);
my $omms = $s1.max-msg-size();
say "max message size = $omms";
my $mms = 512;
ok $s1.max-msg-size($mms), "s2 sets max message size to $mms";
my $nmms = $s1.max-msg-size();
ok $nmms == $mms, "max message size was $omms, now $nmms";
my $olinger = $s1.linger();
my $linger = 500;
ok $s1.linger($linger), "s2 sets linger to 500";
my $nlinger = $s1.linger();
ok $nlinger == $linger, "linger was $olinger, now $nlinger";
my $of = $s1.fd();
my $uri = 'inproc://con';
$s1.bind($uri);
$s2.connect($uri);
my $ep = $s1.last-endpoint;
ok $ep eq $uri, "get last-endpoint string socket option passed {($ep, $uri).perl }";
$s2.disconnect.close;
$s1.unbind.close;
done-testing;