tests: Create a fake library

This is loaded for testing so we don't have to scan a directory for each
test.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2014-05-11 10:18:48 -04:00
parent 24fe8e7ee2
commit 69f4d21c04
7 changed files with 87 additions and 0 deletions

8
tests/Library/album.db Normal file
View File

@ -0,0 +1,8 @@
0
6
1 1993 Link's Awakening
1 1998 Link's Awakening DX
1 2002 Wind Waker
1 2013 Wind Waker HD
1 2006 Twilight Princess GC
1 2006 Twilight Princess Wii

5
tests/Library/artist.db Normal file
View File

@ -0,0 +1,5 @@
0
3
1 Link's Awakening
1 Wind Waker
1 Twilight Princess

3
tests/Library/genre.db Normal file
View File

@ -0,0 +1,3 @@
0
1
1 Zelda Music

3
tests/Library/library.db Normal file
View File

@ -0,0 +1,3 @@
0
1
1 1 /home/Zelda/Music

50
tests/Library/track.db Normal file
View File

@ -0,0 +1,50 @@
0
24
1 0 0 0 0 1 2001 1 10 0 100 Koholint Island
Links Awakening/1 - Koholint Island.ogg
1 0 0 0 0 2 2002 2 11 1 110 Animal Village
Links Awakening/2 - Animal Village.ogg
1 0 0 0 0 3 2003 3 12 2 120 Dream Shrine
Links Awakening/3 - Dream Shrine.ogg
1 0 0 0 0 4 2004 4 13 3 130 Goponga Swamp
Links Awakening/4 - Goponga Swamp.ogg
1 0 0 1 0 1 2003 5 14 4 140 Kanalet Castle
Links Awakening/1 - Kanalet Castle.ogg
1 0 0 1 0 2 2004 6 15 5 150 Mabe Village
Links Awakening/2 - Mabe Village.ogg
1 0 0 1 0 3 2005 7 16 6 160 Mt. Tamaranch
Links Awakening/3 - Mt Tamaranch.ogg
1 0 0 1 0 4 2006 8 17 7 170 Tal Tal Heights
Links Awakening/4 - Tal Tal Heights.ogg
1 0 1 2 0 1 2005 9 18 8 180 Dragon Roost Island
Wind Waker/1 - Dragon Roost Island.ogg
1 0 1 2 0 2 2006 1 19 9 190 Eastern Fairy Island
Wind Waker/2 - Eastern Fairy Island.ogg
1 0 1 2 0 3 2007 2 20 0 200 Forsaken Fortress
Wind Waker/3 - Forsaken Fortress.ogg
1 0 1 2 0 4 2008 3 21 1 210 Ghost Ship
Wind Waker/4 - Ghost Ship.ogg
1 0 1 3 0 1 2007 4 22 2 220 Outset Isle
Wind Waker/1 - Outset Isle.ogg
1 0 1 3 0 2 2008 5 23 3 230 Tingle Island
Wind Waker/2 - Tingle Island.ogg
1 0 1 3 0 3 2009 6 24 4 240 Tower of the Gods
Wind Waker/3 - Tower of the Gods.ogg
1 0 1 3 0 4 2010 7 25 5 250 Windfall Island
Wind Waker/4 - Windfall Island.ogg
1 0 2 4 0 1 2009 8 26 6 260 City in the Sky
Twilight Princess/1 - City in the Sky.ogg
1 0 2 4 0 2 2010 9 27 7 270 Gerudo Desert
Twilight Princess/2 - Gerudo Desert.ogg
1 0 2 4 0 3 2011 1 28 8 280 Arbiter's Grounds
Twilight Princess/3 - Arbiters Grounds.ogg
1 0 2 4 0 4 2012 2 29 9 290 Bridge of Eldin
Twilight Princess/4 - Bridge of Eldin.ogg
1 0 2 5 0 1 2011 3 30 0 300 Death Mountain
Twilight Princess/1 - Death Mountain.ogg
1 0 2 5 0 2 2012 4 10 1 310 Hidden Village
Twilight Princess/2 - Hidden Village.ogg
1 0 2 5 0 3 2013 5 11 2 320 Malo Mart
Twilight Princess/3 - Malo Mart.ogg
1 0 2 5 0 4 2014 6 12 3 330 Faron Woods
Twilight Princess/4 - Faron Woods.ogg

View File

@ -2,6 +2,7 @@
* Copyright 2014 (c) Anna Schumaker.
*/
#include <queue.h>
#include <tags.h>
#include "test.h"
@ -61,6 +62,9 @@ void test_flags()
int main(int argc, char **argv)
{
test :: cp_library();
tagdb :: init();
run_test("Queue Default Constructor Test", test_default);
run_test("Queue Constructor Test", test_constructor, Q_ENABLED | Q_RANDOM);
run_test("Queue Flag Test", test_flags);

View File

@ -110,6 +110,20 @@ namespace test
if (data_dir_exists())
system(cmd.c_str());
}
void reset_data_dir()
{
std::string cmd = "mkdir -p " + data_dir();
rm_data_dir();
system(cmd.c_str());
}
void cp_library()
{
reset_data_dir();
std::string cmd = "cp -r tests/Library/* " + data_dir();
system(cmd.c_str());
}
}
#define run_test(name, func, ...) \