Пример #1
0
int main(void) {
	testLogicExpressions();
	testOverflow64Counter();
	testInterpolate3d();
	testFindIndex();
	testInterpolate2d();
	testGpsParser();
	testMisc();
	testFuelMap();
	testEngineMath();
	testIgnitionPlanning();
	testEventRegistry();
	testSensors();
	testCyclicBuffer();
	testCrc();
	testMisc();

	testSignalExecutor();

	testHistogram();


	testMalfunctionCentral();

	testConsoleLogic();

	testAngleResolver();

	testPinHelper();
	testSetTableValue();

	testAccelEnrichment();

	testSpeedDensity();

	testFLStack();

	testIdleController();

	testMenuTree();
	testMafLookup();
	testMafFuelMath();

	testPidController();
	testTriggerDecoder();

	//	resizeMap();
	printf("Success 20150407\r\n");
	printAllTriggers();
	return EXIT_SUCCESS;
}
Пример #2
0
static int testCardFunctionality(SCARDCONTEXT ctx, const char *readerName)
{
	SCARDHANDLE hCard;
	DWORD       protocol;
	int         errCount = 0;

	printf("Using reader \"%s\"\n\n", readerName);

	long ret = SCardConnectA(ctx, readerName,
		SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, &hCard, &protocol);

	CHECK_PCSC_RET("SCardConnect", ret);
	if (SCARD_S_SUCCESS == ret)
	{
		delayMS(200);

		printf("--- Get Response tests ---\n");
		errCount += testGetResponse(hCard);

		printf("\n--- Get Response tests within a transaction ---\n");
		ret = SCardBeginTransaction(hCard);
		CHECK_PCSC_RET("SCardBeginTransaction", ret);
		errCount += testGetResponse(hCard);
		ret       = SCardEndTransaction(hCard, SCARD_LEAVE_CARD);
		CHECK_PCSC_RET("SCardBeginTransaction", ret);

		printf("\n--- Test reading a long file ---\n");
		errCount += testLongFileRead(hCard);

		printf("\n--- Test reading a long file within a transaction ---\n");
		ret = SCardBeginTransaction(hCard);
		CHECK_PCSC_RET("SCardBeginTransaction", ret);
		errCount += testLongFileRead(hCard);
		ret       = SCardEndTransaction(hCard, SCARD_LEAVE_CARD);
		CHECK_PCSC_RET("SCardBeginTransaction", ret);

		printf("\n--- Misc tests ---\n");
		errCount += testMisc(hCard);

		ret = SCardDisconnect(hCard, SCARD_LEAVE_CARD);
		CHECK_PCSC_RET("SCardDisconnect", ret);
	}

	if (errCount == 0)
		printf("\nFunctional tests done, no errors\n");
	else
		printf("\nFunctional tests done, %d errors\n", errCount);

	return 0;
}
Пример #3
0
int main( int argc, char **argv )
{
    if( argc > 1 )
    {
        testRead( argv[1] );
        testWrite( argv[1] );
    }
    testMisc();
    
    testCycles();
    
    testHdf5Read();
    
    testHdf5Write();
    
    return 0;
}
Пример #4
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;
}
Пример #5
0
static int testCardFunctionality(SCARDCONTEXT ctx, const char *readerName)
{
	SCARDHANDLE hCard;
	DWORD       protocol;
	int         errCount = 0;

	printf("Using reader \"%s\"\n\n", readerName);
	printf("NOTE: make sure no-one else is accessing the card!\n\n");

	long ret = SCardConnectA(ctx, readerName,
		SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, &hCard, &protocol);

	CHECK_PCSC_RET("SCardConnect", ret);
	if (SCARD_S_SUCCESS == ret)
	{
		delayMS(200);

        printf("--- SCardReconnect tests ---\n");
        errCount += testScardReconnect(hCard, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0);

#ifdef _WIN32
		printf("\n--- SCardState tests ---\n");
		errCount += testSCardState(hCard);
#endif

		printf("\n--- SCardStatus tests ---\n");
		errCount += testSCardStatus(hCard);

#ifndef MAC_OS_X
		printf("\n--- SCardGetAttrib tests ---\n");
		errCount += testSCardGetAttrib(ctx, hCard);
#endif

		printf("\n--- Get Response tests ---\n");
		errCount += testGetResponse(hCard);

		printf("\n--- Get Response tests within a transaction ---\n");
		ret = SCardBeginTransaction(hCard);
		CHECK_PCSC_RET("SCardBeginTransaction", ret);
		errCount += testGetResponse(hCard);
		ret       = SCardEndTransaction(hCard, SCARD_LEAVE_CARD);
		CHECK_PCSC_RET("SCardBeginTransaction", ret);

		printf("\n--- Test reading a long file ---\n");
		errCount += testLongFileRead(hCard);

		printf("\n--- Test reading a long file within a transaction ---\n");
		ret = SCardBeginTransaction(hCard);
		CHECK_PCSC_RET("SCardBeginTransaction", ret);
		errCount += testLongFileRead(hCard);
		ret       = SCardEndTransaction(hCard, SCARD_LEAVE_CARD);
		CHECK_PCSC_RET("SCardBeginTransaction", ret);

		printf("\n--- Misc tests ---\n");
		errCount += testMisc(hCard);

		printf("\n--- Test ListReaders ---\n");
		errCount += testListReaders(ctx);

		ret = SCardDisconnect(hCard, SCARD_LEAVE_CARD);
		CHECK_PCSC_RET("SCardDisconnect", ret);
	}

	if (errCount == 0)
		printf("\nFunctional tests done, no errors\n");
	else
		printf("\nFunctional tests done, %d errors\n", errCount);

	return 0;
}