예제 #1
0
void FParser::Run(char *rover, char *data, char *end)
{
	Rover = rover;
	try
	{
		PrevSection = NULL;  // clear it
		
		while(*Rover)   // go through the script executing each statement
		{
			// past end of script?
			if(Rover > end)
				break;
			
			PrevSection = Section; // store from prev. statement
			
			// get the line and tokens
			GetTokens(Rover);
			
			if(!NumTokens)
			{
				if(Section)       // no tokens but a brace
				{
					// possible } at end of loop:
					// refer to spec.c
					spec_brace();
				}
				
				continue;  // continue to next statement
			}
			
			if(script_debug) PrintTokens();   // debug
			RunStatement();         // run the statement
		}
	}
	catch (const CFsError &err)
	{
		ErrorMessage(err.msg);
	}
	catch (const CFsTerminator &)
	{
		// The script has signalled that it wants to be terminated in an orderly fashion.
	}
}
예제 #2
0
파일: test.c 프로젝트: 0xc0170/cox
//*****************************************************************************
//
//! \brief Test execution thread function.
//!
//! \param None
//!
//! \details Test execution thread function.
//!
//! \return The test result xtrue or xfalse.
//
//*****************************************************************************
xtBoolean 
TestMain(void) 
{
    int i, j;

    TestIOInit();

    PrintLine("");
    PrintLine("*** CooCox CoIDE components test suites");
    PrintLine("***");
#ifdef TEST_COMPONENTS_NAME
    Print("*** Components: ");
    PrintLine(TEST_COMPONENTS_NAME);
#endif
#ifdef TEST_COMPONENTS_VERSION
    Print("*** Version:       ");
    PrintLine(TEST_COMPONENTS_VERSION);
#endif
#ifdef TEST_BOARD_NAME
    Print("*** Test Board:   ");
    PrintLine(TEST_BOARD_NAME);
#endif
    PrintLine("");

    g_bGlobalFail = xfalse;
    i = 0;
    while (g_psPatterns[i]) 
    {
        j = 0;
        while (g_psPatterns[i][j]) 
        {
            PrintNewLine();
            Print("--- Test Case ");
            PrintN(i + 1);
            Print(".");
            PrintN(j + 1);
            Print(" (");
            Print((char *)g_psPatterns[i][j]->GetTest());
            PrintLine(")");

            ExecuteTest(g_psPatterns[i][j]);
            if (g_bLocalFail == xtrue)
            {
                Print("--- Result: FAILURE ");
                PrintLine("");
                //
                //printf error information
                //
                Print(g_pcErrorInfoBuffer);
                PrintLine("");
                if (g_pcTokensBuffer < g_pcTok)
                {
                    Print(" The tokens in buffer is: ");
                    PrintTokens();
                    PrintLine("");
                }
            }
            else
            {
                PrintLine("--- Result: SUCCESS ");
            }
            j++;
        }
        i++;
    }

    PrintNewLine();
    PrintLine("");
    Print("Final result: ");

    if (g_bGlobalFail == xtrue)
    PrintLine("FAILURE");
    else
    PrintLine("SUCCESS");

    return g_bGlobalFail;
}