dnl Copyright (C) 2020  Free Software Foundation

dnl This program is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.

dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dnl GNU General Public License for more details.

dnl You should have received a copy of the GNU General Public License
dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.

AT_BANNER([pspp-output])

AT_SETUP([pspp-output dir])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv], [0], [dnl
- group "Set" command "Set"
- group "Title" command "Title"
    - text "Page Title" command "Title"
- group "Data List" command "Data List"
    - table "Reading 1 record from INLINE." command "Data List" subtype "Fixed Data Records"
- group "Begin Data" command "Begin Data"
- group "List" command "List"
    - table "Data List" command "List"
- group "Frequencies" command "Frequencies"
    - table "Statistics" command "Frequencies"
    - table "v0" command "Frequencies" subtype "Frequencies"
    - table "v1" command "Frequencies" subtype "Frequencies"
    - table "v2" command "Frequencies" subtype "Frequencies"
- group "Regression" command "Regression"
    - table "Model Summary (v2)" command "Regression" subtype "Model Summary"
    - table "ANOVA (v2)" command "Regression" subtype "ANOVA"
    - table "Coefficients (v2)" command "Regression" subtype "Coefficients"
])
AT_CLEANUP

AT_SETUP([pspp-output --select equal])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --select=tables],
  [0], [dnl
- table "Reading 1 record from INLINE." command "Data List" subtype "Fixed Data Records"
- table "Data List" command "List"
- table "Statistics" command "Frequencies"
- table "v0" command "Frequencies" subtype "Frequencies"
- table "v1" command "Frequencies" subtype "Frequencies"
- table "v2" command "Frequencies" subtype "Frequencies"
- table "Model Summary (v2)" command "Regression" subtype "Model Summary"
- table "ANOVA (v2)" command "Regression" subtype "ANOVA"
- table "Coefficients (v2)" command "Regression" subtype "Coefficients"
])
AT_CLEANUP

AT_SETUP([pspp-output --select unequal])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --select=^outlineheaders],
  [0], [dnl
- text "Page Title" command "Title"
- table "Reading 1 record from INLINE." command "Data List" subtype "Fixed Data Records"
- table "Data List" command "List"
- table "Statistics" command "Frequencies"
- table "v0" command "Frequencies" subtype "Frequencies"
- table "v1" command "Frequencies" subtype "Frequencies"
- table "v2" command "Frequencies" subtype "Frequencies"
- table "Model Summary (v2)" command "Regression" subtype "Model Summary"
- table "ANOVA (v2)" command "Regression" subtype "ANOVA"
- table "Coefficients (v2)" command "Regression" subtype "Coefficients"
])
AT_CLEANUP

AT_SETUP([pspp-output --commands equal])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --commands='reg*'],
  [0], [dnl
- group "Regression" command "Regression"
    - table "Model Summary (v2)" command "Regression" subtype "Model Summary"
    - table "ANOVA (v2)" command "Regression" subtype "ANOVA"
    - table "Coefficients (v2)" command "Regression" subtype "Coefficients"
])
AT_CLEANUP

AT_SETUP([pspp-output --commands unequal])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --commands='^reg*'],
  [0], [dnl
- group "Set" command "Set"
- group "Title" command "Title"
    - text "Page Title" command "Title"
- group "Data List" command "Data List"
    - table "Reading 1 record from INLINE." command "Data List" subtype "Fixed Data Records"
- group "Begin Data" command "Begin Data"
- group "List" command "List"
    - table "Data List" command "List"
- group "Frequencies" command "Frequencies"
    - table "Statistics" command "Frequencies"
    - table "v0" command "Frequencies" subtype "Frequencies"
    - table "v1" command "Frequencies" subtype "Frequencies"
    - table "v2" command "Frequencies" subtype "Frequencies"
])
AT_CLEANUP

AT_SETUP([pspp-output --nth-commands])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --nth-commands=2,4,6],
  [0], [dnl
- group "Title" command "Title"
    - text "Page Title" command "Title"
- group "Begin Data" command "Begin Data"
- group "Frequencies" command "Frequencies"
    - table "Statistics" command "Frequencies"
    - table "v0" command "Frequencies" subtype "Frequencies"
    - table "v1" command "Frequencies" subtype "Frequencies"
    - table "v2" command "Frequencies" subtype "Frequencies"
])
AT_CLEANUP

AT_SETUP([pspp-output --subtypes equal])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --subtypes='freq*'],
  [0], [dnl
- table "v0" command "Frequencies" subtype "Frequencies"
- table "v1" command "Frequencies" subtype "Frequencies"
- table "v2" command "Frequencies" subtype "Frequencies"
])
AT_CLEANUP

AT_SETUP([pspp-output --subtypes unequal])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --subtypes='^freq*'],
  [0], [dnl
- group "Set" command "Set"
- group "Title" command "Title"
    - text "Page Title" command "Title"
- group "Data List" command "Data List"
    - table "Reading 1 record from INLINE." command "Data List" subtype "Fixed Data Records"
- group "Begin Data" command "Begin Data"
- group "List" command "List"
    - table "Data List" command "List"
- group "Frequencies" command "Frequencies"
    - table "Statistics" command "Frequencies"
- group "Regression" command "Regression"
    - table "Model Summary (v2)" command "Regression" subtype "Model Summary"
    - table "ANOVA (v2)" command "Regression" subtype "ANOVA"
    - table "Coefficients (v2)" command "Regression" subtype "Coefficients"
])
AT_CLEANUP

AT_SETUP([pspp-output --labels equal])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --labels='v*'],
  [0], [dnl
- table "v0" command "Frequencies" subtype "Frequencies"
- table "v1" command "Frequencies" subtype "Frequencies"
- table "v2" command "Frequencies" subtype "Frequencies"
])
AT_CLEANUP

AT_SETUP([pspp-output --labels unequal])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --labels='^data*'],
  [0], [dnl
- group "Set" command "Set"
- group "Title" command "Title"
    - text "Page Title" command "Title"
- table "Reading 1 record from INLINE." command "Data List" subtype "Fixed Data Records"
- group "Begin Data" command "Begin Data"
- group "List" command "List"
- group "Frequencies" command "Frequencies"
    - table "Statistics" command "Frequencies"
    - table "v0" command "Frequencies" subtype "Frequencies"
    - table "v1" command "Frequencies" subtype "Frequencies"
    - table "v2" command "Frequencies" subtype "Frequencies"
- group "Regression" command "Regression"
    - table "Model Summary (v2)" command "Regression" subtype "Model Summary"
    - table "ANOVA (v2)" command "Regression" subtype "ANOVA"
    - table "Coefficients (v2)" command "Regression" subtype "Coefficients"
])
AT_CLEANUP

AT_SETUP([pspp-output --instances])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --instances=1],
  [0], [dnl
- text "Page Title" command "Title"
- table "Reading 1 record from INLINE." command "Data List" subtype "Fixed Data Records"
- table "Data List" command "List"
- table "Statistics" command "Frequencies"
- table "Model Summary (v2)" command "Regression" subtype "Model Summary"
])
AT_CLEANUP

AT_SETUP([pspp-output --instances=last])
AT_KEYWORDS([--instances last])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --instances=last],
  [0], [dnl
- text "Page Title" command "Title"
- table "Reading 1 record from INLINE." command "Data List" subtype "Fixed Data Records"
- table "Data List" command "List"
- table "v2" command "Frequencies" subtype "Frequencies"
- table "Coefficients (v2)" command "Regression" subtype "Coefficients"
])
AT_CLEANUP

dnl XXX Currently PSPP doesn't output hidden items so no tests
dnl XXX for --show-hidden.

AT_SETUP([pspp-output --or])
AT_CHECK([pspp-output dir $srcdir/utilities/regress.spv --select=outlineheaders --or --labels='v*'],
  [0], [dnl
- group "Set" command "Set"
- group "Title" command "Title"
- group "Data List" command "Data List"
- group "Begin Data" command "Begin Data"
- group "List" command "List"
- group "Frequencies" command "Frequencies"
    - table "v0" command "Frequencies" subtype "Frequencies"
    - table "v1" command "Frequencies" subtype "Frequencies"
    - table "v2" command "Frequencies" subtype "Frequencies"
- group "Regression" command "Regression"
])
AT_CLEANUP

AT_SETUP([pspp-output convert])
AT_CHECK([pspp-output convert $srcdir/utilities/regress.spv -O format=csv - --subtypes='model*'], [0], [dnl
Table: Model Summary (v2)
R,R Square,Adjusted R Square,Std. Error of the Estimate
.96,.92,.91,1.49
])
AT_CLEANUP
