#!/bin/sh

#:Test ZUK
# --------

# Initialize
# ----------
. $srcdir/t.config
DIR=t-0112_out
rm -rf $DIR
mkdir $DIR
cd $DIR


# Run the test
# ------------

cat > orbs.txt << EOT
integer matrix rows=1 cols=24
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
integer matrix rows=1 cols=24
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
EOT
zcv -Q orbs.txt orbs || error "ZCV failed"
for f in $TEST_FIELDS ; do
    zuk -Q ${DATA}/Mat$f orbs x || error "ZUK failed"
    cmp ${DATA}/Mat$f x || error "ZUK with trivial orbits: wrong result"
done


cat > orbs.txt << EOT
integer matrix rows=1 cols=26
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 0 23
integer matrix rows=1 cols=24
2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
EOT
zcv -Q orbs.txt orbs || error "ZCV failed"
for f in 2 5 9 25 67 125 256 ; do
    zuk -Q ${DATA}/Mat$f orbs x$f || error "ZUK failed"
done
../checksum x2 108.2330969734 || exit 1
../checksum x5 228.2024623685 || exit 1
../checksum x9 324.3705451271 || exit 1
../checksum x25 636.903809115 || exit 1
../checksum x67 636.518282449 || exit 1
../checksum x125 636.113758504 || exit 1
../checksum x256 636.811420983 || exit 1
