Michael Uleysky
8 years ago
8 changed files with 127 additions and 0 deletions
@ -0,0 +1,34 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
MAKEMAP="${1:-/tmp/save/build/src/makemap}" |
||||||
|
TPATH=tests |
||||||
|
|
||||||
|
SCRW=`tput cols` |
||||||
|
|
||||||
|
set -o pipefail |
||||||
|
|
||||||
|
for n in "$TPATH"/*; do |
||||||
|
status=`cat $n|grep "# Status: "|sed "s/# Status: //"` |
||||||
|
desc=`cat $n|grep "# Description: "|sed "s/# Description: //"` |
||||||
|
hash=`cat $n|grep "# Output hash: "|sed "s/.*: //"` |
||||||
|
while [ ${#desc} -lt $((SCRW-5)) ]; do desc+=" "; done |
||||||
|
echo -n "$desc" |
||||||
|
t=`mktemp` |
||||||
|
grep -v -E "# .*: " "$n">$t |
||||||
|
thash=`$MAKEMAP "$t" 2>&1 | sha256sum|sed "s/ .*//"` |
||||||
|
ret=$? |
||||||
|
if [ "$status" == "ok" ]; then |
||||||
|
if [ "$hash" == "$thash" -a "$ret" == "0" ]; then |
||||||
|
echo -e "\033[32mOk \033[0m" |
||||||
|
else |
||||||
|
echo -e "\033[31mFail\033[0m" |
||||||
|
fi |
||||||
|
else |
||||||
|
if [ "$hash" == "$thash" -a "$ret" != "0" ]; then |
||||||
|
echo -e "\033[32mOk \033[0m" |
||||||
|
else |
||||||
|
echo -e "\033[31mFail\033[0m" |
||||||
|
fi |
||||||
|
fi |
||||||
|
rm $t |
||||||
|
done |
@ -0,0 +1,34 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
name="$1" |
||||||
|
desc="$2" |
||||||
|
TLOC="${3:-/tmp/save/test}" |
||||||
|
MAKEMAP="${4:-/tmp/save/build/src/makemap}" |
||||||
|
|
||||||
|
if [ -f tests/"$name" ]; then |
||||||
|
echo "Test $name already exist." |
||||||
|
exit 1 |
||||||
|
fi |
||||||
|
|
||||||
|
if [ ! -f "$TLOC" ]; then |
||||||
|
echo "Configuration file $TLOC not found." |
||||||
|
exit 2 |
||||||
|
fi |
||||||
|
|
||||||
|
if [ ! -x "$MAKEMAP" ]; then |
||||||
|
echo "Can't exec file $MAKEMAP." |
||||||
|
exit 3 |
||||||
|
fi |
||||||
|
|
||||||
|
echo "# Description: $desc" >tests/$name |
||||||
|
if "$MAKEMAP" "$TLOC" &>/dev/null; then |
||||||
|
hash=`"$MAKEMAP" "$TLOC" 2>/dev/null|sha256sum|sed "s/ .*//"` |
||||||
|
status=ok |
||||||
|
else |
||||||
|
hash=`"$MAKEMAP" "$TLOC" 2>&1|sha256sum|sed "s/ .*//"` |
||||||
|
status=fail |
||||||
|
fi |
||||||
|
echo "# Status: $status" >>tests/$name |
||||||
|
echo "# Output hash: $hash" >>tests/$name |
||||||
|
cat "$TLOC" >>tests/$name |
||||||
|
|
@ -0,0 +1,11 @@ |
|||||||
|
# Description: Coord tests. Must passed. |
||||||
|
# Status: ok |
||||||
|
# Output hash: 1a1ca4aba24d0fe39407eef250167aca5c21373722f5f2a9bd6495cee34abaf2 |
||||||
|
@use "gmt" |
||||||
|
|
||||||
|
a=Coord("10:30:18"); |
||||||
|
b=Coord(10.5); |
||||||
|
c=Coord(":10:10"); |
||||||
|
d=Coord("-0:15:18"); |
||||||
|
|
||||||
|
print(a,a.n,b,b.n,c,c.n,d,d.n); |
@ -0,0 +1,8 @@ |
|||||||
|
# Description: Non-integer degrees in dd:mm:ss mode. |
||||||
|
# Status: fail |
||||||
|
# Output hash: 9469953f706df02349e019f8b47a499d169113b654aee46cacb966d01a27848c |
||||||
|
@use "gmt" |
||||||
|
|
||||||
|
a=Coord("1.0:10"); |
||||||
|
|
||||||
|
print(a); |
@ -0,0 +1,10 @@ |
|||||||
|
# Description: Global regions test. |
||||||
|
# Status: ok |
||||||
|
# Output hash: e661246caef9b2a5fa5a96b9d75c0542d2e0e655de9d63d755aff01cd3b4ceba |
||||||
|
@use "gmt" |
||||||
|
|
||||||
|
r1=Region("global"); |
||||||
|
r2=Region("global360"); |
||||||
|
r3=Region("global180"); |
||||||
|
|
||||||
|
print(r1,r1.xb,r1.xe,r2,r2.xb,r2.xe,r3,r3.xb,r3.xe); |
@ -0,0 +1,9 @@ |
|||||||
|
# Description: Test sequential form of Region. |
||||||
|
# Status: ok |
||||||
|
# Output hash: a8006abe2c42b9e34c692ab88cf2f869ad6a01d1f32e6da842c1320f0d253d1c |
||||||
|
@use "gmt" |
||||||
|
|
||||||
|
r1=Region("10:30",20.5,-10.5,100,"bbox"); |
||||||
|
r2=Region("10:30",-10.5,20.5,100); |
||||||
|
|
||||||
|
print(r1,r2,r1.yb,r2.yb); |
@ -0,0 +1,13 @@ |
|||||||
|
# Description: Check named pairs form of Region. |
||||||
|
# Status: ok |
||||||
|
# Output hash: cf4acbeb2da3156fe52f1f374d4dc83a1aa0ee129a8aa2b1975ec828dd23cabe |
||||||
|
@use "gmt" |
||||||
|
|
||||||
|
r=Region("10:30",-10.5,20.5,100); |
||||||
|
r1=Region(r,type="bbox"); |
||||||
|
r2=Region(r,type="global180"); |
||||||
|
r3=Region(r,ye=80.5); |
||||||
|
l=(xb=r.xb.n-0.5,(xe=20+r.xb.n-10,yb=-10),(ye="11:30:28")); |
||||||
|
rr=Region(l, type="bbox"); |
||||||
|
|
||||||
|
print(r,r1,r2,r3,rr); |
Loading…
Reference in new issue