/video-contact-sheet/branches/1.13/tests/src/tests.txt |
---|
0,0 → 1,15 |
# $Id$ |
# Format: |
# test input [input ...] : expected_result |
# |
get_interval 1h : 3600 |
get_interval 1h1m : 3660 |
get_interval 1h1m1 : 3661 |
get_interval 1h1m1s : 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 |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |
/video-contact-sheet/branches/1.13/tests/src/make_test.bash |
---|
0,0 → 1,25 |
#!/bin/bash |
# This file can be used to generate a test script |
# The actual tests are contained in tests.txt |
testsfile=$(dirname "$0")/tests.txt |
TESTNAME=$1 |
shift |
REQS=$@ |
echo '#!/bin/bash' |
for req in $REQS; do |
echo "source $req" |
done |
echo "source src/unittest.bash" |
echo 'while read line ; do' |
echo ' unittest $line' |
echo 'done <<< "$(sed "/^[[:space:]]*#/d" "'$testsfile'" | grep "^'${TESTNAME}' ")"' |
Property changes: |
Added: svn:executable |
+* |
\ No newline at end of property |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |
/video-contact-sheet/branches/1.13/tests/src/unittest.bash |
---|
0,0 → 1,32 |
# |
# $Id$ |
# Receives the raw input as found in tests.txt |
# |
TESTNUM=0 |
G=$(tput setaf 2 ; tput bold ) |
R=$(tput setaf 1 ; tput bold) |
CLR=$(tput sgr0) |
set +e |
function unittest { |
let 'TESTNUM++' |
a="$@" |
fn=$(cut -d' ' -f1 <<<"$a") |
if [[ $TESTNUM -eq 1 ]]; then |
type $fn |
fi |
args=$(cut -d' ' -f2- <<<"$a" | sed 's/:.*$//' | sed 's/ *$//') |
expected=$(cut -d' ' -f2- <<<"$a" | sed 's/.*://') |
echo "$fn($args) -> $expected" >&2 |
ret=$($fn $args) |
if [[ $ret != $expected ]] && ! fptest "$ret" ~ "$expected" ; then |
echo -n "${R}FAILED => $ret != '$expected'" |
else |
echo -n "${G}PASSED => $ret ~= $expected" |
fi |
echo $CLR |
} |
Property changes: |
Added: svn:keywords |
+Rev Id Date |
\ No newline at end of property |