]> git.donarmstrong.com Git - deb_pkgs/libstatistics-r-perl.git/blob - t/07-robust.t
New upstream version 0.34
[deb_pkgs/libstatistics-r-perl.git] / t / 07-robust.t
1 #! perl
2
3 use strict;
4 use warnings;
5 use Test::More;
6 use Statistics::R;
7
8
9 my ($R, $input);
10
11 ok $R = Statistics::R->new();
12
13
14 # Test that we can recover from a R quit() command
15 is $R->run(q`quit()`), '', 'Handle quit()';
16 is $R->run(q`cat("foo")`), 'foo';
17
18
19 # Test that large arrays can be read
20 ok $R->set('y', [1 .. 100_000]), 'Large arrays';
21 is $R->get('y')->[-1], 100_000;
22
23
24 # Test that the IOs are well-oiled. In Statistics::R version 0.20, a slight
25 # imprecision in the regular expression to parse the output stream caused a
26 # problem that was apparent only once every few thousands times
27 ok $R->set('z', $input), 'Smooth IO';
28 for my $i (1 .. 10_000) {
29    is $R->get('z'), undef;
30 }
31
32 ok $R->stop();
33
34
35 done_testing;