#!/bin/bash
source ../test_common.sh
set_test_name "${BASH_SOURCE[0]}"

testfun() {
    [[ -f orthologer.sh ]] || { echo "error: setup_test.sh not executed"; return 255; }

    # check setup
    ./orthologer.sh -xp >& /dev/null || { echo "error: failed check - run ./orthologer.sh -xp to see details"; return 255; }

    # run full pipeline
    ./orthologer.sh -r all

    # check existance of result
    local C=
    local ec=0
    local ecMax=0
    local cmp=0
    for C in 7148 7157 7164; do
        local fclus="Cluster/${C}.og"
        [[ -f ${fclus} ]] || { echo "error: missing result file ${fclus}"; return 255; }
    
        # compare with reference
        cmp_with_ref "$fclus" "proj_tree/ref_$(basename $fclus)"
        ec=$?
        (( ec >= ecMax )) && { cmp=$CMPREF_F1; ecMax=$ec; }
    done
    CMPREF_F1=$cmp
    return $ecMax;
}
run_test
exit $?
