1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
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.
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.
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/>.
17 AT_BANNER([calculating moments])
19 m4_define([MOMENTS_TESTCASES],
20 [[[1 2 3 4], [W=4.000 M1=2.500 M2=1.667 M3=0.000 M4=-1.200]],
21 [[1*5 2*5 3*5 4*5], [W=20.000 M1=2.500 M2=1.316 M3=0.000 M4=-1.401]],
22 [[1*1 2*2 3*3 4*4], [W=10.000 M1=3.000 M2=1.111 M3=-0.712 M4=-0.450]],
23 [[1*0], [W=0.000 M1=sysmis M2=sysmis M3=sysmis M4=sysmis]],
24 [[1*1], [W=1.000 M1=1.000 M2=sysmis M3=sysmis M4=sysmis]],
25 [[1*2], [W=2.000 M1=1.000 M2=0.000 M3=sysmis M4=sysmis]],
26 [[1*3], [W=3.000 M1=1.000 M2=0.000 M3=sysmis M4=sysmis]],
27 [[1*2 3], [W=3.000 M1=1.667 M2=1.333 M3=1.732 M4=sysmis]],
28 [[1 1.00000001], [W=2.000 M1=1.000 M2=0.000 M3=sysmis M4=sysmis]],
29 [[1000001 1000002 1000003 1000004], [W=4.000 M1=1000002.500 M2=1.667 M3=0.000 M4=-1.200]]])
31 m4_define([TEST_MOMENTS],
32 [AT_SETUP([$1 moments])
33 AT_CAPTURE_FILE([moments.sps])
34 AT_DATA([moments.sps],
35 [m4_foreach([pair], [MOMENTS_TESTCASES], [DEBUG MOMENTS $2/m4_car(pair).
37 AT_CHECK([pspp --testing-mode --no-output moments.sps], [0],
39 [m4_foreach([pair], [MOMENTS_TESTCASES], [m4_argn([2], pair)
44 TEST_MOMENTS([two-pass], [])
45 TEST_MOMENTS([one-pass], [ONEPASS])