#!/bin/sh

failed=0
check () {
    command="$1"
    expected="$2"
    result=`$command`
    echo -n "testing $command ... "
    if [ "$result" != "$expected" ]; then
        echo "failed:"
        echo "  Expected: $expected"
        echo "  Got: $result"
	failed=1
    else
	echo "ok"
    fi
}

check "lrcoef/lrcoef 3 2 1 - 2 1 - 2 1 " "2"

check "lrcoef/skew 3 2 1 - 2 1         " "1  (3)
2  (2, 1)
1  (1, 1, 1)"

check "lrcoef/skew -r 2 3 2 1 / 2 1    " "1  (3)
2  (2, 1)"

check "lrcoef/mult 2 1 - 2 1           " "1  (3, 3)
1  (4, 2)
1  (2, 2, 1, 1)
1  (2, 2, 2)
2  (3, 2, 1)
1  (4, 1, 1)
1  (3, 1, 1, 1)"

check "lrcoef/mult -f 3,2 3 2 1 - 3 2 1       " "1  (4, 4, 4)
1  (5, 4, 3)"

check "lrcoef/mult -q 3,2 3 2 1 - 3 2 1       " "1  (2)
1  (1, 1)"

check "lrcoef/coprod 3 2 1             " "1  (3, 1)  (2)
1  (2, 2)  (1, 1)
1  (3, 1)  (1, 1)
1  (2, 1)  (3)
2  (2, 1)  (2, 1)
1  (2, 2, 1)  (1)
1  (3, 2, 1)  ()
1  (3, 2)  (1)
1  (2, 1, 1)  (2)
1  (3, 1, 1)  (1)
1  (1, 1, 1)  (2, 1)
1  (2, 1, 1)  (1, 1)
1  (2, 2)  (2)"

check "schubert/schubmult 1 3 2 - 1 3 2" "1  (1, 4, 2, 3)
1  (2, 3, 1)"

exit $failed
