#!/bin/sh

set -e

test_dir="$AUTOPKGTEST_TMP"
if [ -z "$test_dir" ] ; then
    test_dir="$(mktemp -d)"
fi

name=hs-2009-25-n-web

solve-field debian/tests/${name}.jpg -D ${test_dir} 2>&1 |\
    tee ${test_dir}/${name}.log

for ext in axy solved match wcs rdls corr new ; do
    ls -l ${test_dir}/${name}.${ext}
    test -s ${test_dir}/${name}.${ext}
done

# Check if the Carina constellation was found here
grep -q Carina ${test_dir}/${name}.log

# Check some stars which are close to the edges
for s in ρCen μVel βCha ηMus δVel μ2Cru; do
    grep -q "The star $s" ${test_dir}/${name}.log
done

if [ "$test_dir" != "$ADTTMP" ] ; then
   rm -rf "$test_dir"
fi
