set -e

#
# run normal mode
#
echo ''
echo \$ $NXF_RUN
$NXF_RUN | tee stdout

[[ `grep 'INFO' .nextflow.log | grep -c 'Submitted process > split'` == 1 ]] || false
[[ `grep 'INFO' .nextflow.log | grep -c 'Submitted process > printTwo'` == 1 ]] || false
[[ `grep 'INFO' .nextflow.log | grep -c 'Submitted process > printLast'` == 2 ]] || false



#
# RESUME mode
#
echo ''
echo \$ $NXF_RUN -resume
$NXF_RUN -resume | tee stdout

[[ `grep 'INFO' .nextflow.log | grep -c 'Cached process > split'` == 1 ]] || false
[[ `grep 'INFO' .nextflow.log | grep -c 'Cached process > printTwo'` == 1 ]] || false
[[ `grep 'INFO' .nextflow.log | grep -c 'Cached process > printLast'` == 2 ]] || false