Subversion Repositories pub

Compare Revisions

Ignore whitespace Rev 559 → Rev 560

/video-contact-sheet/branches/1.13/tests/GNUmakefile
20,6 → 20,7
mkdir -p inc/
echo 'declare -r RELEASE=0' > $@
echo 'declare DEBUG=1' >> $@
echo 'INTERNAL_TRACE_FILTER=TRACE_NOTHING' >>$@
echo '$(shell grep -m1 'VERSION=' "$(VCS)")' >> $@
sed -n '/{{{ # Constants/,/}}}/p' "$(VCS)" >> $@
 
/video-contact-sheet/branches/1.13/tests/src/make_test.bash
21,5 → 21,10
echo ' unittest $line'
echo 'done <<< "$(sed "/^[[:space:]]*#/d" "'$testsfile'" | grep "^'${TESTNAME}' ")"'
 
echo 'if [[ $RET -eq 0 ]]; then'
echo ' echo -n "${G}All tests passed"'
echo 'else'
echo ' echo -n "${R}Some tests failed"'
echo 'fi'
echo 'echo $CLR'
 
 
/video-contact-sheet/branches/1.13/tests/src/unittest.bash
21,13 → 21,27
args=$(cut -d' ' -f2- <<<"$a" | sed 's/:.*$//' | sed 's/ *$//')
expected=$(cut -d' ' -f2- <<<"$a" | sed 's/.*://')
echo "$fn($args) -> $expected" >&2
ret=$($fn $args)
RET=$[ $RET + $?]
if [[ $ret != $expected ]] && ! fptest "$ret" ~ "$expected" ; then
echo -n "${R}FAILED => $ret != '$expected'"
res=$($fn $args)
ret=$?
passed=
if [[ $expected == '><' ]]; then # Expected to fail
if [[ $ret != 0 ]]; then
passed=1
else
passed=0
fi
elif [[ $res != $expected ]] && ( [[ $res ]] && ! fptest "$res" ~ "$expected" ) ; then
passed=0
else
echo -n "${G}PASSED => $ret ~= $expected"
passed=1
fi
 
if [[ $passed -ne 1 ]]; then
echo -n "${R}FAILED => $res != '$expected'"
let 'RET++'
else
echo -n "${G}PASSED => $res ~= $expected"
fi
echo $CLR
}
 
/video-contact-sheet/branches/1.13/tests/src/tests.txt
1,15 → 1,41
# $Id$
# Format:
# test input [input ...] : expected_result
#
# >< as expected result means the operation will fail
 
####################
#################### get_interval() tests
####################
 
get_interval 1h : 3600
get_interval 1h1m : 3660
get_interval 1h1m1 : 3661
get_interval 1h1m1s : 3661
get_interval 100 : 100
 
# Leading 0's
get_interval 010 : 10
get_interval 01h0m01m01s : 3661
 
# Case insensitive
get_interval 1H1M1S1s : 3662
 
# Reverse order of mangnitudes
get_interval 1s1m1h : 3661
 
get_interval 1.22 : 1.22
get_interval 1s.22 : 1.22
get_interval .11.11.11 : 0.33
get_interval 1s.11.11 : 1.22
 
# Rejected inputs
get_interval s : ><
get_interval .11s : ><
get_interval 1ss : ><
 
# Repeated units
get_interval 1s1s1s1s : 4
get_interval 1m1m1m1m : 240
get_interval 1h1h1h1h : 14400