This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
new perldelta
[perl5.git] / cpan / Socket / t / ipv6_mreq.t
1 use v5.6.1;
2 use strict;
3 use warnings;
4 use Test::More;
5
6 use Socket qw(
7     pack_ipv6_mreq unpack_ipv6_mreq
8 );
9
10 # Check that pack/unpack_ipv6_mreq either croak with "Not implemented", or
11 # roundtrip as identity
12
13 my $packed;
14 eval {
15     $packed = pack_ipv6_mreq "ANADDRESSIN16CHR", 123;
16 };
17 if( !defined $packed ) {
18     plan skip_all => "No pack_ipv6_mreq" if $@ =~ m/ not implemented /;
19     die $@;
20 }
21
22 plan tests => 2;
23
24 my @unpacked = unpack_ipv6_mreq $packed;
25
26 is( $unpacked[0], "ANADDRESSIN16CHR", 'unpack_ipv6_mreq multiaddr' );
27 is( $unpacked[1], 123,                'unpack_ipv6_mreq ifindex' );