Subversion Repositories pub

Compare Revisions

Problem with comparison.

Ignore whitespace Rev HEAD → Rev 519

/video-contact-sheet/branches/1.13/tests/GNUmakefile
0,0 → 1,37
# $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) \
$(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 '$(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
/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
/video-contact-sheet/branches/1.13/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