2006-09-08 12:26:36 +02:00
|
|
|
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
use Test::More tests => 3;
|
|
|
|
|
|
|
|
BEGIN { use_ok( 'TimeSeries' ); }
|
|
|
|
|
|
|
|
|
|
|
|
my $ts = TimeSeries->new(output_format => 'ps');
|
|
|
|
ok($ts, 'create timeseries');
|
|
|
|
$ts->add(0, 100);
|
|
|
|
$ts->add(1000, 200);
|
|
|
|
$ts->add(2000, 100);
|
|
|
|
$ts->add(3000, undef);
|
2007-02-17 13:55:22 +01:00
|
|
|
$ts->add(4000, 150);
|
2006-09-08 12:26:36 +02:00
|
|
|
$ts->add(5000, 200);
|
|
|
|
$ts->add(6000, 100);
|
|
|
|
$ts->legend('missing');
|
|
|
|
my $p = $ts->plot();
|
2007-02-17 13:55:22 +01:00
|
|
|
# Postscript file visually inspected and copied postscript code.
|
|
|
|
# The real graph is the MLLMLL pattern. The MVVVL after it is the
|
|
|
|
# bounding rectangle, so we could compute if the coordinates are
|
|
|
|
# correct, if we wanted to.
|
|
|
|
|
|
|
|
# open(my $fh, '>:raw', "t/3missing.ps");
|
|
|
|
# print $fh $p;
|
|
|
|
# close($fh);
|
|
|
|
my $t = "
|
|
|
|
LT0
|
|
|
|
6607 4807 M
|
|
|
|
303 0 V
|
|
|
|
410 960 M
|
|
|
|
1513 4920 L
|
|
|
|
2617 960 L
|
|
|
|
4823 2940 M
|
|
|
|
5927 4920 L
|
|
|
|
7030 960 L
|
2006-09-08 12:26:36 +02:00
|
|
|
1.000 UL
|
|
|
|
LTb
|
2007-02-17 13:55:22 +01:00
|
|
|
410 960 M
|
|
|
|
6620 0 V
|
|
|
|
0 3960 V
|
|
|
|
-6620 0 V
|
|
|
|
410 960 L
|
2006-09-08 12:26:36 +02:00
|
|
|
1.000 UP
|
2007-02-17 13:55:22 +01:00
|
|
|
stroke
|
|
|
|
";
|
2006-09-08 12:26:36 +02:00
|
|
|
ok(index($p, $t) != -1, 'postscript output looks ok');
|
|
|
|
|
|
|
|
#vim:tw=0
|
|
|
|
|