#!/bin/bash -ex

for f in $VECTORS/*.jwsc; do
    cmpct=`cat $f`
    flat=`echo $f | sed 's|jwsc|jwsf|'`
    gen=`echo $f | sed 's|jwsc|jwsg|'`

    if [ -f $flat ]; then
        [ `jose jws fmt -i $flat -c` == $cmpct ]
        [ `jose jws fmt -i $flat | jose jws fmt -i- -c` == $cmpct ]
    fi

    if [ -f $gen ]; then
        [ `jose jws fmt -i $gen -c` == $cmpct ]
        [ `jose jws fmt -i $gen | jose jws fmt -i- -c` == $cmpct ]
    fi

    [ `jose jws fmt -i $f -c` == $cmpct ]
    [ `jose jws fmt -i $f | jose jws fmt -i- -c` == $cmpct ]
done