Add copyright and licence notices to files which lack them.
[pspp] / tests / math / moments.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl 
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl 
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl AT_BANNER([calculating moments])
17
18 m4_define([MOMENTS_TESTCASES],
19   [[[1 2 3 4], [W=4.000 M1=2.500 M2=1.667 M3=0.000 M4=-1.200]],
20   [[1*5 2*5 3*5 4*5], [W=20.000 M1=2.500 M2=1.316 M3=0.000 M4=-1.401]],
21   [[1*1 2*2 3*3 4*4], [W=10.000 M1=3.000 M2=1.111 M3=-0.712 M4=-0.450]],
22   [[1*0], [W=0.000 M1=sysmis M2=sysmis M3=sysmis M4=sysmis]],
23   [[1*1], [W=1.000 M1=1.000 M2=sysmis M3=sysmis M4=sysmis]],
24   [[1*2], [W=2.000 M1=1.000 M2=0.000 M3=sysmis M4=sysmis]],
25   [[1*3], [W=3.000 M1=1.000 M2=0.000 M3=sysmis M4=sysmis]],
26   [[1*2 3], [W=3.000 M1=1.667 M2=1.333 M3=1.732 M4=sysmis]],
27   [[1 1.00000001], [W=2.000 M1=1.000 M2=0.000 M3=sysmis M4=sysmis]],
28   [[1000001 1000002 1000003 1000004], [W=4.000 M1=1000002.500 M2=1.667 M3=0.000 M4=-1.200]]])
29
30 m4_define([TEST_MOMENTS],
31   [AT_SETUP([$1 moments])
32    AT_CAPTURE_FILE([moments.sps])
33    AT_DATA([moments.sps],
34 [m4_foreach([pair], [MOMENTS_TESTCASES], [DEBUG MOMENTS $2/m4_car(pair).
35 ])])
36    AT_CHECK([pspp --testing-mode --no-output moments.sps], [0], 
37   [],
38   [m4_foreach([pair], [MOMENTS_TESTCASES], [m4_argn([2], pair)
39 ])])
40    AT_CLEANUP
41 ])
42
43 TEST_MOMENTS([two-pass], [])
44 TEST_MOMENTS([one-pass], [ONEPASS])