[gnumeric] Tests: add test for regression tool.



commit d1dd56947ad6a0695bec772f33dcfb2f176783a7
Author: Morten Welinder <terra gnome org>
Date:   Tue Aug 16 19:50:13 2016 -0400

    Tests: add test for regression tool.

 samples/tool-tests.gnumeric |  Bin 0 -> 2374 bytes
 test/Makefile.am            |    2 +
 test/t7200-regression.pl    |   60 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/samples/tool-tests.gnumeric b/samples/tool-tests.gnumeric
new file mode 100644
index 0000000..ac309d8
Binary files /dev/null and b/samples/tool-tests.gnumeric differ
diff --git a/test/Makefile.am b/test/Makefile.am
index 377ca03..a8038df 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -18,6 +18,7 @@
 # 7xxx: Features
 # 70xx:   Goal seek
 # 71xx:   Solver
+# 72xx:   Analysis tools
 #
 # 8xxx: Runs with valgrind and similar tools.
 # 80xx:   Valgrind
@@ -139,6 +140,7 @@ TESTS =     t1000-statfuns.pl                       \
        t7145-solver-Eckerle4.pl                \
        t7146-solver-Rat43.pl                   \
        t7147-solver-Bennett5.pl                \
+       t7200-regression.pl                     \
        t8000-valgrind.pl                       \
        t8001-valgrind-xls.pl                   \
        t8002-valgrind-gnumeric.pl              \
diff --git a/test/t7200-regression.pl b/test/t7200-regression.pl
new file mode 100755
index 0000000..db6cd06
--- /dev/null
+++ b/test/t7200-regression.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+my $expected;
+{ local $/; $expected = <DATA>; }
+
+&message ("Check regression tool.");
+my $file = "$samples/tool-tests.gnumeric";
+&GnumericTest::report_skip ("file $file does not exist") unless -r $file;
+
+my %args = 
+    ('x' => 'Data!A1:A30',
+     'y' => 'Data!B1:B30',
+    );
+
+my @args = ('--export-range=A1:G18', '--tool-test=regression');
+foreach my $k (sort keys %args) {
+    my $v = $args{$k};
+    push @args, "--tool-test=$k:$v";
+}
+
+my $tmp = "tool.txt";
+&GnumericTest::junkfile ($tmp);
+
+my $cmd = &GnumericTest::quotearg ($ssconvert, @args, $file, $tmp);
+print STDERR "# $cmd\n" if $GnumericTest::verbose;
+system ($cmd);
+my $actual = &GnumericTest::read_file ($tmp);
+
+if ($actual ne $expected) {
+    &GnumericTest::dump_indented ($actual);
+    die "Fail\n";
+} else {
+    print STDERR "Pass\n";
+}
+
+
+__DATA__
+"SUMMARY OUTPUT",,"Response Variable","Column 2",,,
+,,,,,,
+"Regression Statistics",,,,,,
+"Multiple R",0.7462523057935172,,,,,
+R^2,0.5568925039021411,,,,,
+"Standard Error",1.9266332107144821,,,,,
+"Adjusted R^2",0.5410672361843604,,,,,
+Observations,30,,,,,
+,,,,,,
+ANOVA,,,,,,
+,df,SS,MS,F,"Significance of F",
+Regression,1,130.62262009560348,130.62262009560348,35.19008422691248,2.197070097340739E-06,
+Residual,28,103.93363480158382,3.7119155286279937,,,
+Total,29,234.5562548971873,,,,
+,,,,,,
+,Coefficients,"Standard Error",t-Statistics,p-Value,0.95,0.95
+Intercept,0.4134235230780967,0.7214717512990694,0.5730280116077914,0.5711994028401975,-1.0644443648864401,1.8912914110426335
+"Column 
1",0.24107897994182365,0.04063957822902626,5.9321230792113955,2.197070097340739E-06,0.15783257765793968,0.3243253822257076


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]