Commit 5237f5a9 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Clear database between each test & add a test for file insertion

parent 9621ff9f
......@@ -2,8 +2,39 @@
#include "IMediaLibrary.h"
TEST( MediaLibary, Init )
class MLTest : public testing::Test
{
IMediaLibrary* ml = MediaLibraryFactory::create();
ASSERT_TRUE( ml->initialize( "test.db" ) );
public:
static IMediaLibrary* ml;
protected:
virtual void SetUp()
{
ml = MediaLibraryFactory::create();
bool res = ml->initialize( "test.db" );
ASSERT_TRUE( res );
}
virtual void TearDown()
{
delete ml;
unlink("test.db");
}
};
IMediaLibrary* MLTest::ml;
TEST_F( MLTest, Init )
{
// only test for correct test fixture behavior
}
TEST_F( MLTest, InsertFile )
{
IFile* f = ml->addFile( "/dev/null" );
ASSERT_TRUE( f != NULL );
std::vector<IFile*> files = ml->files();
ASSERT_EQ( files.size(), 1u );
ASSERT_EQ( files[0]->mrl(), f->mrl() );
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment