From: Ben Pfaff Date: Sat, 6 Nov 2021 18:30:15 +0000 (-0700) Subject: Make tests pass again. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cee5b24767768a6a6213a8005e3f285cb9137920;p=pspp Make tests pass again. --- diff --git a/src/language/stats/matrix.c b/src/language/stats/matrix.c index 3cdd037207..ab58a51104 100644 --- a/src/language/stats/matrix.c +++ b/src/language/stats/matrix.c @@ -2443,7 +2443,7 @@ matrix_expr_evaluate_seq (gsl_matrix *start_, gsl_matrix *end_, } long int n = (end >= start && by > 0 ? (end - start + by) / by - : end < start && by < 0 ? (start - end - by) / -by + : end <= start && by < 0 ? (start - end - by) / -by : 0); gsl_matrix *m = gsl_matrix_alloc (1, n); for (long int i = 0; i < n; i++) diff --git a/tests/language/stats/matrix.at b/tests/language/stats/matrix.at index 71e8d280dc..154231ed3b 100644 --- a/tests/language/stats/matrix.at +++ b/tests/language/stats/matrix.at @@ -1161,14 +1161,14 @@ AT_CHECK([pspp matrix.sps], [1], [dnl {1:1:-1} 1 -matrix.sps:12: error: MATRIX: The increment operand to : must be nonzero. +matrix.sps:15: error: MATRIX: The increment operand to : must be nonzero. -matrix.sps:13: error: MATRIX: The increment operand to : must be nonzero. +matrix.sps:16: error: MATRIX: The increment operand to : must be nonzero. -matrix.sps:15: error: MATRIX: All rows in a matrix must have the same number of +matrix.sps:18: error: MATRIX: All rows in a matrix must have the same number of columns, but this tries to stack matrices with 2 and 1 columns. -matrix.sps:16: error: MATRIX: All columns in a matrix must have the same number +matrix.sps:19: error: MATRIX: All columns in a matrix must have the same number of rows, but this tries to paste matrices with 2 and 1 rows. ]) AT_CLEANUP @@ -1407,7 +1407,7 @@ dsort 1.00 3.00 matrix.sps:22: error: MATRIX: GSCH requires its argument to have at least as -many columns as rows, but it has dimensions (2,1). +many columns as rows, but it has dimensions 2×1. matrix.sps:23: error: MATRIX: 2×3 argument to GSCH contains only 0 linearly independent columns. @@ -1479,6 +1479,9 @@ LG10({1, 10, 100, 1000}) LN({1, 2; 3, 4}) .00 .69 1.10 1.39 + +LN(0) + -In ]) AT_CLEANUP @@ -1833,8 +1836,7 @@ SOLVE({2, 1, -1; -3, -1, 2; -2, 1, 2}, {8; -11; -3}) -1.00 matrix.sps:10: error: MATRIX: SOLVE requires its arguments to have the same -number of rows, but the first argument has dimensions (2,2) and the second -(1,2). +number of rows, but the first argument has dimensions 2×2 and the second 1×2. SQRT({0, 1, 2, 3, 4, 9, 81}) .00 1.00 1.41 1.73 2.00 3.00 9.00 @@ -1935,6 +1937,21 @@ SWEEP(s1, 2) 0 0 6 2 12 0 2 28 +SWEEP(s2, 1) + 0 0 0 + 0 4 5 + 0 7 8 + +SWEEP(s2, 2) + -.7500000000 -.2500000000 .7500000000 + .7500000000 .2500000000 1.2500000000 + .7500000000 -1.7500000000 -.7500000000 + +SWEEP(s2, 3) + -1.5000000000 -.7500000000 -.2500000000 + -.7500000000 -.3750000000 -.6250000000 + .7500000000 .8750000000 .1250000000 + TRACE(s0) 68 @@ -2502,6 +2519,10 @@ AT_CLEANUP AT_SETUP([MATRIX - READ]) AT_DATA([matrix.txt], [dnl +9 +8 +7 +6 1 2 3 4 5 6 7 8 9 @@ -2523,6 +2544,8 @@ AT_DATA([matrix2.txt], [dnl ]) AT_DATA([matrix.sps], [dnl MATRIX. +READ x/FILE='matrix.txt'/SIZE=4/FIELD=1 TO 1. +PRINT x. READ x/FILE='matrix.txt'/SIZE={3,3}/FIELD=1 TO 80. PRINT x. READ x/SIZE={2,4}/FIELD=1 TO 80. @@ -2544,6 +2567,12 @@ PRINT y. END MATRIX. ]) AT_CHECK([pspp matrix.sps], [0], [dnl +x + 9 + 8 + 7 + 6 + x 1 2 3 4 5 6