#!/bin/sh
# autopkgtest: smoke-test the cmaple binary
set -e

echo "== cmaple --help reports a version =="
cmaple --help | grep -m1 -oE '[0-9]+(\.[0-9]+)+'

WORKDIR="${AUTOPKGTEST_TMP:-$(mktemp -d)}"
cp "$(dirname "$0")/data/example.maple" "$WORKDIR/example.maple"
cp "$(dirname "$0")/data/tree.nwk" "$WORKDIR/tree.nwk"
cd "$WORKDIR"

echo "== running cmaple on upstream's own example (example.maple + tree.nwk) =="
cmaple -aln example.maple -t tree.nwk --overwrite

test -s example.maple.treefile
echo "-- resulting tree (first 200 chars) --"
head -c 200 example.maple.treefile; echo

# sanity check: it should look like a Newick tree
grep -q ';' example.maple.treefile

echo "OK: cmaple produced a tree file"
