[feedgnuplot] 21/42: first (very early) cut at a functional testing script

Dima Kogan dkogan-guest at alioth.debian.org
Sun Oct 20 08:04:05 UTC 2013


This is an automated email from the git hooks/post-receive script.

dkogan-guest pushed a commit to tag v1.25
in repository feedgnuplot.

commit 1acb30c3cd13f681e6697f741b58ec8c1e96d236
Author: Dima Kogan <dima at secretsauce.net>
Date:   Fri Oct 18 15:17:47 2013 -0700

    first (very early) cut at a functional testing script
---
 MANIFEST  |    1 +
 t/plots.t |   88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 89 insertions(+)

diff --git a/MANIFEST b/MANIFEST
index 7a47fbf..c2ff39a 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3,5 +3,6 @@ MANIFEST
 bin/feedgnuplot
 t/00-load.t
 t/manifest.t
+t/plots.t
 Changes
 LICENSE
diff --git a/t/plots.t b/t/plots.t
new file mode 100644
index 0000000..e510306
--- /dev/null
+++ b/t/plots.t
@@ -0,0 +1,88 @@
+#!/usr/bin/perl
+
+# require a threaded perl for my tests. This block lifted verbatim from the cpantesters wiki
+BEGIN {
+  use Config;
+  if (! $Config{'useithreads'}) {
+    print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
+    exit(0);
+  }
+}
+
+use Test::More tests => 1;
+use Test::Script::Run 'is_script_output';
+use File::Temp 'tempfile';
+
+
+tryplot( [], 'seq 5', <<'EOF' );
+

+
+    5 ++--+---+--+---+---+---+--+--+A
+      +   +   +  +   +   +   +  +  *+
+      |                           * |
+      |                           * |
+  4.5 ++                         * ++
+      |                         *   |
+      |                        *    |
+      |                        *    |
+      |                       *     |
+    4 ++                     A     ++
+      |                     *       |
+      |                    *        |
+      |                   *         |
+  3.5 ++                 *         ++
+      |                 *           |
+      |                *            |
+      |               *             |
+    3 ++             A             ++
+      |             *               |
+      |            *                |
+      |            *                |
+      |           *                 |
+  2.5 ++         *                 ++
+      |         *                   |
+      |         *                   |
+      |        *                    |
+    2 ++      A                    ++
+      |      *                      |
+      |     *                       |
+      |    *                        |
+      |   *                         |
+  1.5 ++  *                        ++
+      |  *                          |
+      | *                           |
+      +*  +   +  +   +   +   +  +   +
+    1 A+--+---+--+---+---+---+--+--++
+      1  1.5  2 2.5  3  3.5  4 4.5  5
+
+EOF
+
+
+
+
+
+
+
+sub tryplot
+{
+  my $extraoptions = shift;
+  my $incmd        = shift;
+  my $ref          = shift;
+
+  my ($fh, $input_filename) = tempfile( UNLINK => 1);
+  open IN, '-|', $incmd;
+  print $fh <IN>;
+  close IN;
+  close $fh;
+
+  my @options = (qw(--lines --points --exit),
+                 '--extracmds', 'unset grid',
+                 '--terminal', 'dumb 40,40',
+                 $input_filename);
+
+  unshift @options, @$extraoptions;
+
+  is_script_output( 'feedgnuplot', \@options,
+                    [$ref =~ /(.*)\n/g], [],
+                    'basic line plot');
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/feedgnuplot.git



More information about the debian-science-commits mailing list