#!/bin/sh
# autopkgtest check: tests the calculator provided by apfloat-calc.
# (C) 2020 Pierre Gruet
# Author: Pierre Gruet <pgt@debian.org>

set -e

SOURCEDIR=$(pwd)
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR

# Compute 3*sin(0.5) and compare it to 1.4 (which is the value with the default rounding).

echo "3*sin(0.5)" | java -cp /usr/share/java/apfloat-calc.jar org.apfloat.calc.Calculator | grep -q "1.4"

if [ $? -ne 0 ]; then
  exit 1
fi

