File: rexp-s3.t

package info (click to toggle)
libstatistics-r-io-perl 1.0002-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,824 kB
  • sloc: perl: 10,895; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 1,052 bytes parent folder | download
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
#!perl -T
use 5.010;
use strict;
use warnings FATAL => 'all';

use Test::More tests => 6;
use Test::Fatal;

use Statistics::R::REXP::List;
use Statistics::R::REXP::Character;
use Statistics::R::REXP::Double;
use Statistics::R::REXP::Integer;

my $empty_list = new_ok('Statistics::R::REXP::List', [  ], 'new generic vector' );

ok(! ($empty_list->attributes && $empty_list->attributes->{'class'}), 'no class');
ok(! $empty_list->inherits('foo'), 'no inheritance');

my $obj = Statistics::R::REXP::List->new(elements => [3.3, '4', 11],
                                         attributes => {
                                             class => Statistics::R::REXP::Character->new([
                                                 'foo', 'data.frame' ]),
                                             names => Statistics::R::REXP::Character->new([
                                                 'a', 'b', 'g' ]),
                                         });
ok( $obj->inherits('foo'));
ok( $obj->inherits('data.frame'));
ok( !$obj->inherits('bar'));