Subversion Repositories pub

Compare Revisions

No changes between revisions

Ignore whitespace Rev 689 → Rev 739

/ATTIC/video-contact-sheet/tags/1.13.4-pre.1/tests/GNUmakefile
0,0 → 1,38
# $Id$
 
VCS:=../vcs
#VCS:=../portability/oldvcs/vcs-1.11.2
extract=sed -n "/^$*()"'/,/^}$$/p' "$(VCS)"
 
 
TESTS_FILE=src/tests.txt
TEST_MAKER=src/make_test.bash
get_interval_reqs = $(addprefix inc/, \
$(addsuffix .func.bash,get_interval trace error \
is_number tolower assert awkexf fptest \
fsimeq notice) \
$(addsuffix .inc.bash,constants) \
)
 
all: get_interval
 
inc/constants.inc.bash: $(VCS)
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)" >> $@
 
get_interval: $(TESTS_FILE) $(get_interval_reqs)
$(TEST_MAKER) $@ $(get_interval_reqs) > $@.test.bash
chmod +x $@.test.bash
 
inc/%.func.bash: $(VCS)
mkdir -p inc
$(extract) >$@
 
clean:
$(RM) inc/* *.test.bash
-rmdir -p inc/
 
Property changes:
Added: svn:keywords
+Rev Id Date
\ No newline at end of property
/ATTIC/video-contact-sheet/tags/1.13.4-pre.1/tests/src/make_test.bash
0,0 → 1,30
#!/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}' ")"'
 
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'
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:keywords
+Rev Id Date
\ No newline at end of property
/ATTIC/video-contact-sheet/tags/1.13.4-pre.1/tests/src/unittest.bash
0,0 → 1,47
#
# $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)
 
RET=0
 
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
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
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
}
 
Property changes:
Added: svn:keywords
+Rev Id Date
\ No newline at end of property
/ATTIC/video-contact-sheet/tags/1.13.4-pre.1/tests/src/tests.txt
0,0 → 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
 
 
Property changes:
Added: svn:keywords
+Rev Id Date
\ No newline at end of property
/ATTIC/video-contact-sheet/tags/1.13.4-pre.1/tests/test_funkymodes
0,0 → 1,27
#!/usr/bin/env bash
 
# Allow setting from the environment
[ "$vcs" ] || vcs='vcs'
 
if [ -z "$1" ]; then
echo "Usage: $0 <file>"
exit 1
fi >&2
 
HEIGHT="-H240"
 
echo "Using vcs: $vcs" >&2
 
yes 01234 | head -n200 > randsource
 
BN=$(basename "$1")
echo ">> Standard <<" >&2
$vcs -n4 -c2 $HEIGHT "$1" -o "$BN-std.jpg"
echo ">> Polaroid <<" >&2
$vcs -n6 -c3 -k polaroid $HEIGHT "$1" -R randsource -o "$BN-polaroid.jpg"
echo ">> Photos <<" >&2
$vcs -n6 -c3 -k photos $HEIGHT "$1" -R randsource -o "$BN-photos.jpg"
echo ">> Filmstrip <<" >&2
$vcs -n8 -c2 -k film $HEIGTH "$1" -R randsource -o "$BN-film.jpg"
 
rm -f randsource
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:keywords
+Rev Id Date
\ No newline at end of property