ocarina/tests/tag_db

61 lines
881 B
Bash
Executable File

#!/bin/bash
# Copyright 2014 (c) Anna Schumaker
. $(dirname $0)/_functions
function test_tag
{
new_test "Test $1 Tag"
./src/tags.run "$2"
}
function test_db_exists
{
if [ ! -f $DATA_DIR/$1.db ]; then
echo "ERROR: $DATA_DIR/$1.db doesn't exist!"
exit 1
fi
}
function test_db_not_exists
{
if [ -f $DATA_DIR/$1.db ]; then
echo "ERROR: $DATA_DIR/$1.db shouldn't exist!"
exit 1
fi
}
test_tag "Artist" "-a"
echo
test_tag "Album" "-A"
echo
test_tag "Genre" "-g"
echo
test_tag "Library" "-l"
echo
test_tag "Track" "-t"
rm -rf $DATA_DIR/*.db
echo
new_test "Test TagDB"
./src/tagdb.run
test_db_exists artist
test_db_exists album
test_db_exists genre
test_db_exists library
test_db_not_exists track
echo
new_test "Test TagDB (call init)"
./src/tagdb.run -i
test_db_exists artist
test_db_exists album
test_db_exists genre
test_db_exists library
test_db_exists track