|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (C) 2023 Albin Ahlbäck |
| 4 | +# |
| 5 | +# This file is part of FLINT. |
| 6 | +# |
| 7 | +# FLINT is free software: you can redistribute it and/or modify it under |
| 8 | +# the terms of the GNU Lesser General Public License (LGPL) as published |
| 9 | +# by the Free Software Foundation; either version 2.1 of the License, or |
| 10 | +# (at your option) any later version. See <http://www.gnu.org/licenses/>. |
| 11 | + |
| 12 | +if test "$1" = "bernoulli"; |
| 13 | +then |
| 14 | + echo -n "bernoulli...." |
| 15 | + res=$($2/bernoulli 20 -threads 2) |
| 16 | + if test "$?" != "0"; |
| 17 | + then |
| 18 | + echo "FAIL" |
| 19 | + exit 1 |
| 20 | + fi |
| 21 | + echo $res | perl -0ne 'if (/-174611\/330/) { $found=1; last } END { exit !$found }' |
| 22 | + if test "$?" != "0"; |
| 23 | + then |
| 24 | + echo "FAIL" |
| 25 | + exit 2 |
| 26 | + fi |
| 27 | + echo "PASS" |
| 28 | + exit 0 |
| 29 | +elif test "$1" = "binet"; |
| 30 | +then |
| 31 | + echo -n "binet...." |
| 32 | + res=$($2/binet -limit 2 8) |
| 33 | + if test "$?" != "0"; |
| 34 | + then |
| 35 | + echo "FAIL" |
| 36 | + exit 1 |
| 37 | + fi |
| 38 | + echo $res | perl -0ne 'if (/21 cpu/) { $found=1; last } END { exit !$found }' |
| 39 | + if test "$?" != "0"; |
| 40 | + then |
| 41 | + echo "FAIL" |
| 42 | + exit 2 |
| 43 | + fi |
| 44 | + echo "PASS" |
| 45 | + exit 0 |
| 46 | +elif test "$1" = "class_poly"; |
| 47 | +then |
| 48 | + echo "class_poly....SKIPPED" |
| 49 | + exit 0 |
| 50 | +elif test "$1" = "complex_plot"; |
| 51 | +then |
| 52 | + echo "complex_plot....SKIPPED" |
| 53 | + exit 0 |
| 54 | +elif test "$1" = "crt"; |
| 55 | +then |
| 56 | + echo "crt....SKIPPED" |
| 57 | + exit 0 |
| 58 | +elif test "$1" = "delta_qexp"; |
| 59 | +then |
| 60 | + echo "delta_qexp....SKIPPED" |
| 61 | + exit 0 |
| 62 | +elif test "$1" = "dft"; |
| 63 | +then |
| 64 | + echo "dft....SKIPPED" |
| 65 | + exit 0 |
| 66 | +elif test "$1" = "elementary"; |
| 67 | +then |
| 68 | + echo -n "elementary...." |
| 69 | + res=$($2/elementary) |
| 70 | + if test "$?" != "0"; |
| 71 | + then |
| 72 | + echo "FAIL" |
| 73 | + exit 1 |
| 74 | + fi |
| 75 | + # Check that the first and last expression prints as intended |
| 76 | + echo "$res" | perl -0ne 'if (/>>> Exp\(Pi\*I\) \+ 1\n0\n/) { $found=1; last } END { exit !$found }' |
| 77 | + if test "$?" != "0"; |
| 78 | + then |
| 79 | + echo "FAIL" |
| 80 | + exit 2 |
| 81 | + fi |
| 82 | + echo "$res" | perl -0ne 'if (/>>> Erf\(2\*Log\(Sqrt\(1\/2-Sqrt\(2\)\/4\)\)\+Log\(4\)\) - Erf\(Log\(2-Sqrt\(2\)\)\)\n0\n/) { $found=1; last } END { exit !$found }' |
| 83 | + if test "$?" != "0"; |
| 84 | + then |
| 85 | + echo "FAIL" |
| 86 | + exit 2 |
| 87 | + fi |
| 88 | + echo "PASS" |
| 89 | + exit 0 |
| 90 | +elif test "$1" = "factor_integer"; |
| 91 | +then |
| 92 | + echo -n "factor_integer...." |
| 93 | + res=$($2/factor_integer -threads 3 144) |
| 94 | + if test "$?" != "0"; |
| 95 | + then |
| 96 | + echo "FAIL" |
| 97 | + exit 1 |
| 98 | + fi |
| 99 | + echo "$res" | perl -0ne 'if (/144 =\n2\^4 \* 3\^2/) { $found=1; last } END { exit !$found }' |
| 100 | + if test "$?" != "0"; |
| 101 | + then |
| 102 | + echo "FAIL" |
| 103 | + exit 2 |
| 104 | + fi |
| 105 | + echo "PASS" |
| 106 | + exit 0 |
| 107 | +elif test "$1" = "factor_polynomial"; |
| 108 | +then |
| 109 | + echo -n "factor_polynomial...." |
| 110 | + res=$($2/factor_polynomial -threads 2 "4*x*(1+x^2+y^2*x^3+z^4)^2") |
| 111 | + if test "$?" != "0"; |
| 112 | + then |
| 113 | + echo "FAIL" |
| 114 | + exit 1 |
| 115 | + fi |
| 116 | + echo "$res" | perl -0ne 'if (/4\*x\^7\*y\^4\+8\*x\^6\*y\^2\+4\*x\^5\+8\*x\^4\*y\^2\*z\^4\+8\*x\^4\*y\^2\+8\*x\^3\*z\^4\+8\*x\^3\+4\*x\*z\^8\+8\*x\*z\^4\+4\*x =\n4\*\(x\)\^1\*\(x\^3\*y\^2\+x\^2\+z\^4\+1\)\^2/) { $found=1; last } END { exit !$found }' |
| 117 | + if test "$?" != "0"; |
| 118 | + then |
| 119 | + echo "FAIL" |
| 120 | + exit 2 |
| 121 | + fi |
| 122 | + echo "PASS" |
| 123 | + exit 0 |
| 124 | +elif test "$1" = "fmpq_poly"; |
| 125 | +then |
| 126 | + echo "fmpq_poly....SKIPPED" |
| 127 | +elif test "$1" = "fmpz_mod_poly"; |
| 128 | +then |
| 129 | + echo "fmpz_mod_poly....SKIPPED" |
| 130 | +elif test "$1" = "fmpz_poly_factor_zassenhaus"; |
| 131 | +then |
| 132 | + echo "fmpz_poly_factor_zassenhaus....SKIPPED" |
| 133 | +elif test "$1" = "fmpz_poly_q"; |
| 134 | +then |
| 135 | + echo "fmpz_poly_q....SKIPPED" |
| 136 | +elif test "$1" = "fpwrap"; |
| 137 | +then |
| 138 | + echo "fpwrap....SKIPPED" |
| 139 | +elif test "$1" = "fq_poly"; |
| 140 | +then |
| 141 | + echo "fq_poly....SKIPPED" |
| 142 | +elif test "$1" = "functions_benchmark"; |
| 143 | +then |
| 144 | + echo "functions_benchmark....SKIPPED" |
| 145 | +elif test "$1" = "hilbert_matrix"; |
| 146 | +then |
| 147 | + echo -n "hilbert_matrix...." |
| 148 | + res=$($2/hilbert_matrix -eig 20) |
| 149 | + if test "$?" != "0"; |
| 150 | + then |
| 151 | + echo "FAIL" |
| 152 | + exit 1 |
| 153 | + fi |
| 154 | + echo "$res" | perl -0ne 'if (/prec=20: nan\nprec=40: nan\nprec=80: nan\nprec=160: nan\nprec=320: \[7\.777377397e-29 \+\/- 1.44e-39\]\nsuccess!\n/) { $found=1; last } END { exit !$found }' |
| 155 | + if test "$?" != "0"; |
| 156 | + then |
| 157 | + echo "FAIL" |
| 158 | + exit 2 |
| 159 | + fi |
| 160 | + echo "PASS" |
| 161 | + exit 0 |
| 162 | +elif test "$1" = "hilbert_matrix_ca"; |
| 163 | +then |
| 164 | + echo "hilbert_matrix_ca....SKIPPED" |
| 165 | +elif test "$1" = "huge_expr"; |
| 166 | +then |
| 167 | + echo "huge_expr....SKIPPED" |
| 168 | +elif test "$1" = "integrals"; |
| 169 | +then |
| 170 | + echo -n "integrals...." |
| 171 | + res=$($2/integrals -i 21 -threads 3) |
| 172 | + if test "$?" != "0"; |
| 173 | + then |
| 174 | + echo "FAIL" |
| 175 | + exit 1 |
| 176 | + fi |
| 177 | + echo "$res" | perl -0ne 'if (/I21 = \[43\.3273391411077 \+\/- 4\.52e-14] \+ \[\+\/- 1\.95e-14\]\*I/) { $found=1; last } END { exit !$found }' |
| 178 | + if test "$?" != "0"; |
| 179 | + then |
| 180 | + echo "FAIL" |
| 181 | + exit 2 |
| 182 | + fi |
| 183 | + echo "PASS" |
| 184 | + exit 0 |
| 185 | +elif test "$1" = "keiper_li"; |
| 186 | +then |
| 187 | + echo "keiper_li....SKIPPED" |
| 188 | +elif test "$1" = "lcentral"; |
| 189 | +then |
| 190 | + echo "lcentral....SKIPPED" |
| 191 | +elif test "$1" = "logistic"; |
| 192 | +then |
| 193 | + echo "logistic....SKIPPED" |
| 194 | +elif test "$1" = "lvalue"; |
| 195 | +then |
| 196 | + echo "lvalue....SKIPPED" |
| 197 | +elif test "$1" = "machin"; |
| 198 | +then |
| 199 | + echo "machin....SKIPPED" |
| 200 | +elif test "$1" = "multi_crt"; |
| 201 | +then |
| 202 | + echo "multi_crt....SKIPPED" |
| 203 | +elif test "$1" = "padic"; |
| 204 | +then |
| 205 | + echo "padic....SKIPPED" |
| 206 | +elif test "$1" = "partitions"; |
| 207 | +then |
| 208 | + echo "partitions....SKIPPED" |
| 209 | +elif test "$1" = "pi"; |
| 210 | +then |
| 211 | + echo -n "pi...." |
| 212 | + res=$($2/pi 1000 -threads 2) |
| 213 | + if test "$?" != "0"; |
| 214 | + then |
| 215 | + echo "FAIL" |
| 216 | + exit 1 |
| 217 | + fi |
| 218 | + echo "$res" | perl -0ne 'if (/\[3\.14159265358979323846\{\.\.\.959 digits\.\.\.\}76611195909216420199 \+\/- 8\.09e-1001\]/) { $found=1; last } END { exit !$found }' |
| 219 | + if test "$?" != "0"; |
| 220 | + then |
| 221 | + echo "FAIL" |
| 222 | + exit 2 |
| 223 | + fi |
| 224 | + echo "PASS" |
| 225 | + exit 0 |
| 226 | +elif test "$1" = "poly_roots"; |
| 227 | +then |
| 228 | + echo -n "poly_roots...." |
| 229 | + res=$($2/poly_roots t 10) |
| 230 | + if test "$?" != "0"; |
| 231 | + then |
| 232 | + echo "FAIL" |
| 233 | + exit 1 |
| 234 | + fi |
| 235 | + echo "$res" | perl -0ne 'if (/\n10 roots with multiplicity 1\nsearching for 10 roots, 5 deflated\nprec=32: 5 isolated roots/) { $found=1; last } END { exit !$found }' |
| 236 | + if test "$?" != "0"; |
| 237 | + then |
| 238 | + echo "FAIL" |
| 239 | + exit 2 |
| 240 | + fi |
| 241 | + echo "PASS" |
| 242 | + exit 0 |
| 243 | +elif test "$1" = "primegen"; |
| 244 | +then |
| 245 | + echo "primegen....SKIPPED" |
| 246 | +elif test "$1" = "qadic"; |
| 247 | +then |
| 248 | + echo "qadic....SKIPPED" |
| 249 | +elif test "$1" = "radix"; |
| 250 | +then |
| 251 | + echo "radix....SKIPPED" |
| 252 | +elif test "$1" = "real_roots"; |
| 253 | +then |
| 254 | + echo "real_roots....SKIPPED" |
| 255 | +elif test "$1" = "stirling_matrix"; |
| 256 | +then |
| 257 | + echo "stirling_matrix....SKIPPED" |
| 258 | +elif test "$1" = "swinnerton_dyer_poly"; |
| 259 | +then |
| 260 | + echo "swinnerton_dyer_poly....SKIPPED" |
| 261 | +elif test "$1" = "taylor_integrals"; |
| 262 | +then |
| 263 | + echo "taylor_integrals....SKIPPED" |
| 264 | +elif test "$1" = "zeta_zeros"; |
| 265 | +then |
| 266 | + echo -n "zeta_zeros...." |
| 267 | + res=$($2/zeta_zeros -count 100 -threads 3) |
| 268 | + if test "$?" != "0"; |
| 269 | + then |
| 270 | + echo "FAIL" |
| 271 | + exit 1 |
| 272 | + fi |
| 273 | + echo "$res" | perl -0ne 'if (/97\t231\.2501887004991648\n98\t231\.9872352531802486\n99\t233\.6934041789083006\n100\t236\.5242296658162058/) { $found=1; last } END { exit !$found }' |
| 274 | + if test "$?" != "0"; |
| 275 | + then |
| 276 | + echo "FAIL" |
| 277 | + exit 2 |
| 278 | + fi |
| 279 | + echo "PASS" |
| 280 | + exit 0 |
| 281 | +else |
| 282 | + exit 3 |
| 283 | +fi |
0 commit comments