1#!/bin/bash -u
2
3modules=(
4    bigint
5    bigfloat
6    bigrat
7    bignum
8)
9
10backends=(
11    #FastCalc
12    GMP
13    Pari
14    #GMPz
15    #BitVect
16    #LTM
17)
18
19dirname=$( dirname -- "$0" ) || exit
20cd "$dirname" || exit
21
22gitroot=$( git rev-parse --show-toplevel ) || exit
23cd "$gitroot" || exit
24
25for backend in ${backends[@]}; do
26    for module in ${modules[@]}; do
27        file=t/backend-${backend,,}-$module.t
28        cat <<EOF >$file
29# -*- mode: perl; -*-
30
31use strict;
32use warnings;
33
34use Test::More;
35
36BEGIN {
37    eval { require Math::BigInt::$backend; };
38    if (\$@) {
39        plan skip_all => "Math::BigInt::$backend not installed";
40    } else {
41        plan tests => "1";
42    }
43}
44
45use $module only => "$backend";
46
47my \$x = 1;
48is(\$x -> config("lib"), "Math::BigInt::$backend",
49   "backend is Math::BigInt::$backend");
50EOF
51        echo "Wrote '$file'"
52    done
53done
54