ocarina/tests/database
Anna Schumaker fc8dc9d55e database: Design and test updates
I add:
- Autosaving option
- Real iterators
- Better accessor functions

The new design and unit test also allows me to remove the 300,000+ line
"database.good" file that the old tests were based on.

Signed-off-by: Anna Schumaker <schumaker.anna@gmail.com>
2014-04-06 19:57:05 -04:00

46 lines
716 B
Bash
Executable File

#!/bin/bash
# Copyright 2014 (c) Anna Schumaker
. $(dirname $0)/_functions
function test_autosave
{
new_test "Database Test (n = $1, autosave = true)"
src/database.run -a $1
if [ ! -f $DATA_DIR/database.db ]; then
echo "ERROR: $DATA_DIR/database.db doesn't exist!"
exit 1
fi
}
function test_noautosave
{
new_test "Database Test (n = $1, autosave = false)"
src/database.run $1
if [ -f $DATA_DIR/database.db ]; then
echo "ERROR: $DATA_DIR/database.db exists!"
exit 1
fi
}
function run_test
{
rm $DATA_DIR/* 2>/dev/null || true
if [ $1 -le 1000 ]; then
test_autosave $1
else
test_noautosave $1
fi
}
run_test 10
echo
run_test 100
echo
run_test 1000
echo
run_test 10000
echo
run_test 100000