示例#1
0
int main()
{
// Setup system clock
	initializeClock();	// Will need the clock for all parts

// Part 1: KDS Timer Interrupts and RGB PWM
	// Setup timers
	setupTPM();

#ifdef PART3
	dmaSetup();	// If doing Part 3, setup DMA Controller
#endif
	// Run profiler on memory functions
	testMemory();

	// Run profiler on printf functions
	testPrint();


    return 0;
}
示例#2
0
int main( int argc, char **argv )
{
    /* DATA */
    int rc = 0;

    char *argValue = 0;

    int seed = 1;

    char flagTestAll = 0;
    char flagTestPreconditions = 0;
    char flagTestMisc = 0;
    char flagTestMemory = 0;
    char flagTestEncodingDecoding = 0;

    char flagTestAnySet = 0;


    /* CODE */
    printf( "Testing:\n" );
    printf( "     %s %s\n", PINTO_NAME, PINTO_VERSION_STRING );
    printf( "     %s\n", PINTO_COPYRIGHT );
    printf( "\n" );

    /* **************************************** */
    rc = getArgValue( argc, argv, "-s", &argValue );
    if ( rc == 0 )
    {
        seed = atol( argValue );
    }
    else
    {
        seed = time( NULL );
    }

    /* **************************************** */
    rc = getArgValue( argc, argv, "-t", &argValue );
    if ( rc == 0 )
    {
        if ( strcmp( argValue, "all" ) == 0 )
        {
            flagTestAll = 1;
            flagTestAnySet = 1;
        }
        else if ( strcmp( argValue, "pre" ) == 0 )
        {
            flagTestPreconditions = 1;
            flagTestAnySet = 1;
        }
        else if ( strcmp( argValue, "misc" ) == 0 )
        {
            flagTestMisc = 1;
            flagTestAnySet = 1;
        }
        else if ( strcmp( argValue, "memory" ) == 0 )
        {
            flagTestMemory = 1;
            flagTestAnySet = 1;
        }
        else if ( strcmp( argValue, "image" ) == 0 )
        {
            flagTestEncodingDecoding = 1;
            flagTestAnySet = 1;
        }
        else
        {
            fprintf( stderr, "UNKNOWN TEST TO RUN: \"%s\"\n", argValue );
            TEST_ERR_IF( 1 );
        }
    }

    if ( flagTestAnySet == 0 )
    {
        fprintf( stderr, "Usage: pintoTest [options]\n" );
        fprintf( stderr, "  -s <NUMBER>    Seed for random number generator\n" );
        fprintf( stderr, "  -t <TEST>      Test to run\n" );
        fprintf( stderr, "                 Possible tests:\n" );
        fprintf( stderr, "                   all = all tests\n" );
        fprintf( stderr, "                   pre = preconditions\n" );
        fprintf( stderr, "                   misc = misc\n" );
        fprintf( stderr, "                   memory = memory\n" );
        fprintf( stderr, "                   image = encoding/decoding\n" );
        fprintf( stderr, "\n" );

        return -1;
    }

    /* **************************************** */
    printf( "Using seed: %d\n", seed );
    fflush( stdout );
    srand( seed );

    /* **************************************** */
    TEST_ERR_IF( sizeof( s32 ) != 4 );
    TEST_ERR_IF( sizeof( u8 ) != 1 );

    /* **************************************** */
    if ( flagTestAll || flagTestPreconditions )
    {
        TEST_ERR_IF( testPreconditions() != 0 );
    }

    if ( flagTestAll || flagTestMisc )
    {
        TEST_ERR_IF( testMisc() != 0 );
    }

    if ( flagTestAll || flagTestEncodingDecoding )
    {
        TEST_ERR_IF( testEncodingDecoding() != 0 );
    }

    if ( flagTestAll || flagTestMemory )
    {
        TEST_ERR_IF( testMemory() != 0 );
    }

    /* **************************************** */
    /* success! */
    printf( "SUCCESS!\n\n" );

    return 0;


    /* CLEANUP */
cleanup:

    printf( "FAILED AT %d\n\n", rc );

    return rc;
}