diff --git a/stepmania/src/tests/test_misc.cpp b/stepmania/src/tests/test_misc.cpp new file mode 100644 index 0000000000..99c2c9b727 --- /dev/null +++ b/stepmania/src/tests/test_misc.cpp @@ -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; +} + + diff --git a/stepmania/src/tests/test_misc.h b/stepmania/src/tests/test_misc.h new file mode 100644 index 0000000000..9e2bf52859 --- /dev/null +++ b/stepmania/src/tests/test_misc.h @@ -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