--- /dev/null
+#!/bin/sh
+
+# test addfile
+
+. tap.sh
+
+plan 3
+
+PF=test.db
+
+rm -f $PF
+touch $PF
+
+zpm-test $PF
+failsok empty file is not zpm file
+rm -f $PF
+
+appid=$(sqlite3 $PF 'pragma application_id')
+zpm-test $PF
+failsok empty db is not zpm file
+rm -f $PF
+
+zpm-init $PF
+zpm-test $PF
+okexit 'new init db is zpm file'
+
+finish
+
+rm -f test.*
--- /dev/null
+#!/bin/sh
+
+# tests a package file
+
+# just checks that all args are valid pkg files
+verbose=0
+
+while getopts v opt; do
+ case $opt in
+ v) verbose=1 ;;
+ esac
+done
+
+for pkgfile in "$@"; do
+appid=$(sqlite3 $pkgfile 'pragma application_id;' | ( echo obase = 16; cat - ) | bc)
+if [ "$appid" != "5A504442" ]; then
+ if [ "$verbose" -eq 1 ]; then
+ echo $pkgfile does not appear to be a zpm package file 1>&2
+ fi
+ exit 1
+fi
+done
+
+exit 0