#!/bin/sh -e

this=show
indir=debian/tests
outdir=${ADT_ARTIFACTS:-/tmp}/${this}
mkdir -p ${outdir}

ppx='ppx_deriving.show'
cp ${indir}/${this}.ml ${indir}/${this}.expected ${outdir}
cd ${outdir}
ocamlbuild -quiet -use-ocamlfind -pkgs ${ppx} ${this}.byte
./${this}.byte > result
diff result ${this}.expected

if [ -x /usr/bin/ocamlopt ]
then ocamlbuild -quiet -use-ocamlfind -pkgs ${ppx} ${this}.native;
     ./${this}.native > result
     diff result ${this}.expected
fi
