#!/bin/sh

set -e

infile=test.bib
outdir=${ADT_ARTIFACTS}
outfile=${outdir}/test.out.bib

# bib2bib without filter argument should be the identity up to cosmetic 
# changes, but we have to remove comments issued by bib2bib
bib2bib --quiet -oc /dev/null ${infile} | grep -va "@comment" > ${outfile}
# check that the number of bibtex stanzas is the same 
[ `egrep -c "@[a-zA-Z]+" ${infile}` -eq `egrep -c "@[a-zA-Z]+" ${outfile}` ]
