test helpers

This commit is contained in:
Glenn Maynard
2004-03-04 07:23:06 +00:00
parent 2926d41a60
commit 20ec016227
2 changed files with 65 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
#include "global.h"
#include "test_misc.h"
#include "RageFileManager.h"
#include "RageLog.h"
static CString g_Driver = "dir", g_Root = ".";
static CString argv0;
void test_handle_args( int argc, char *argv[] )
{
argv0 = argv[0];
while( 1 )
{
opterr = 0;
int opt = getopt( argc, argv, "cd:r:h" );
if( opt == -1 )
break;
switch( opt )
{
case 'd':
g_Driver = optarg;
break;
case 'r':
g_Root = optarg;
break;
case 'h':
printf( "options:\n" );
printf( " -c: create test files\n" );
printf( " -d driver: choose file driver to test (default \"Dir\")\n" );
printf( " -r root: set file driver root (default \".\")\n" );
exit(1);
}
}
}
void test_init()
{
FILEMAN = new RageFileManager( argv0 );
FILEMAN->Mount( g_Driver, g_Root, "" );
LOG = new RageLog();
LOG->SetLogToDisk( false );
LOG->SetShowLogOutput( true );
LOG->SetFlushing( true );
}
void test_deinit()
{
delete LOG;
delete FILEMAN;
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef TEST_HELPERS_H
#define TEST_HELPERS_H
void test_handle_args( int argc, char *argv[] );
void test_init();
void test_deinit();
#endif