void TestScanner() { TestBegin("Scanner"); Scanner s; Token tok; s.From( " \t\n" " \ta.b = 1;\n" " > < == <= >= != =~ && || . , : ; [ ] ( ) { } = + += -= *\r\n" "123 0123 0xafbDDdd00\r" "01233999 00. 1E9 1E-9 1e+9 1.1e900\n" "\'fasdfa/#@$@@@\\n\'\n" "\"fjalksdfjal#@$@#$@#\\n\"\n" "_abcd\r" ); while( s.NextToken(&tok) && tok.Rep() != TOK_eof ){ tok.Print(); std::putchar('\n'); } TestEnd(); }
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { if( FAILED( InitWindow( hInstance, nCmdShow ) ) ) return 0; TestStart(); // Main message loop MSG msg = {0}; while( WM_QUIT != msg.message ) { while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } //Do render here TestUpdate(); } TestEnd(); return ( int )msg.wParam; }
void CTextParser::StepLeft(void) { char* szSearchPos; //Can only move left if we are not sitting to the left of the first character. if (mszParserPos >= mszStartOfText) { mszParserPos = &mszParserPos[-1]; if (mszParserPos[0] == '\n') { miLine--; szSearchPos = &mszParserPos[-1]; miColumn = 0; if (szSearchPos > mszStartOfText) { for (;;) { if ((szSearchPos[0] == '\n') || (szSearchPos == mszStartOfText)) { break; } miColumn++; szSearchPos = &szSearchPos[-1]; } } } else { miColumn--; } } TestEnd(); }
int main(int argc, void** argv) { UNUSED_ARG(argc); UNUSED_ARG(argv); TestOpen("t_sqliteapi test"); TestTitle(); TestHeapMark(); TestEnvCreate(); TestSqliteApi(); TwoReadersTest(); TwoWritersTest(); ThreadsTest(); TwoSyncThreadsTest(); TwoConnectionsTest(); UdfTest(); TestEnvDestroy(); TestHeapMarkEnd(); TestEnd(); TestClose(); return 0; }
void CTextParser::LoadState(SParseState* psParserState) { mszParserPos = psParserState->sCurrent.szParserPos; miLine = psParserState->sCurrent.iLine; miColumn = psParserState->sCurrent.iColumn; masPositions.Copy(&psParserState->asPrev); TestEnd(); }
void CTextParser::PassPositions(int iNum) { if (iNum == 0) { return; } masPositions.RemoveRange(masPositions.NumElements()-iNum, masPositions.NumElements()); TestEnd(); }
void CTextParser::PopPosition(void) { STextPosition sTextPosition; masPositions.Pop(&sTextPosition); miLine = sTextPosition.iLine; miColumn = sTextPosition.iColumn; mszParserPos = sTextPosition.szParserPos; TestEnd(); }
void CTextParser::Restart(void) { mszParserPos = mszStartOfText; miLine = 0; miColumn = 0; masPositions.Kill(); masPositions.Init(1); PushPosition(); TestEnd(); }
void CTextParser::PopPositions(int iNum) { STextPosition* psTextPosition; psTextPosition = masPositions.Get(masPositions.NumElements()-iNum-0); miLine = psTextPosition->iLine; miColumn = psTextPosition->iColumn; mszParserPos = psTextPosition->szParserPos; masPositions.RemoveRange(masPositions.NumElements()-iNum, masPositions.NumElements()); TestEnd(); }
void test_xml_parser::Run() { TestBegin(); XMLParser myparser((char *) "configuration.xml"); std::string value; bool status = false; try { mTestsRun++; if(myparser.parseXML() == ERROR) { std::cout << "failed to parse the xml " << std::endl; return; } else mTestsPassed++; // myparser.PrintMap(); } catch(...) { std::cout << "caught error" <<std::endl; } mTestsRun++; if (myparser.find("/configuration/nasdaq/name").compare("Nasdaq") == 0) status = true; else { std::cout << "could not find /configuration/nasdaq/name" << std::endl; } if(status) // if we passed part one continue to part 2. { if(myparser.find("/configuration/nasdaq/sources/database/host").compare("mm1.local") == 0 ) status = true; else { std::cout << "could not find /configuration/nasdaq/sources/database/host" << std::endl; } } /* if part one or part two failed the test failed else we passed*/ if(status) mTestsPassed++; TestEnd(); return; }
///////////////////////////////////////////////////////////////////////////// // This function loads the modifier.bin data into the three tier list /////// ///////////////////////////////////////////////////////////////////////////// void ModifierBin::Load_Modifier(char* buff, long len) { string st = buff; // Create retention string stringstream rdr(st,ios::in); // Create string stream using rentention string char buff2[255]; // Our data buffer MOD_LIST list; MOD_OBJ obj; ModProperty prop; // While ! END, get next line for(; GetString(&rdr,buff2) && TestEnd(buff2); NULL) { if( !buff2[0] ) // Ignore null lines continue; // While ! END, get next line for(strcpy(list.SectionTitle,buff2); GetString(&rdr,buff2) && TestEnd(buff2); NULL) { if( !buff2[0] ) continue; for(strcpy(obj.ObjectName,buff2); GetString(&rdr,buff2) && TestEnd(buff2); NULL) { if( !buff2[0] ) continue; prop.Load(buff2); // Load property into the object obj.Properties.push_back(prop); } list.ElementList.push_back(obj); // Load object into the header list obj.Properties.clear(); } ModifierList.push_back(list); // Load header list into the master list list.ElementList.clear(); } }
BOOL CTextParser::Init(char* szText, int iTextLen) { //This assumes that szText has already been passified. if (szText == NULL) { miLine = 0; miColumn = 0; mszStartOfText = NULL; mszParserPos = NULL; mszEndOfText = NULL; miTextLen = 0; mbCaseSensitive = TRUE; mbAnnotated = FALSE; mbOutsideText = TRUE; masPositions.Init(32); return TRUE; } else if (CountCarriageReturns(szText, iTextLen) == 0) { miLine = 0; miColumn = 0; mszStartOfText = szText; mszParserPos = szText; mszEndOfText = &mszStartOfText[iTextLen - 1]; miTextLen = iTextLen; mbCaseSensitive = TRUE; mbAnnotated = FALSE; TestEnd(); masPositions.Init(32); PushPosition(); return TRUE; } else { miLine = 0; miColumn = 0; mszStartOfText = NULL; mszParserPos = NULL; mszEndOfText = NULL; miTextLen = 0; masPositions.Init(32); gcLogger.Error("Parsed text contains carriage returns."); return FALSE; } }
void CTextParser::StepRight(void) { //Can only move right if we are not sitting to the right of the last character. if (mszParserPos <= mszEndOfText) { if (mszParserPos[0] == '\n') { miLine++; miColumn = 0; } else { miColumn++; } mszParserPos = &mszParserPos[1]; } TestEnd(); }
void TestRTTI() { TestBegin("RTTI"); D1 d1; D2 d2; const D1 cd1; D1 *pd1 = &d1; D2 *pd2 = &d2; D1 **ppd1 = &pd1; // this is valid =,= bug? const D1* cpd1 = pd1; D2* const pcd2 = pd2; const D2* const cpcd2 = pd2; std::printf("d1 %d\n", isa<Base>(d1)); // 0 std::printf("cd1 %d\n", isa<D2>(cd1)); // 0 std::printf("pd1 %d\n", isa<D1>(pd1)); // 1 std::printf("cpd1 %d\n", isa<D2>(cpd1)); // 0 std::printf("pcd2 %d\n", isa<D2>(pcd2)); // 1 std::printf("cpcd2 %d\n", isa<D2>(cpcd2)); // 1 std::printf("ppd1 %d\n", isa<D1>(ppd1)); // 1 std::putchar('\n'); Base *b = pd1; pd1 = dyn_cast<D1>(b); std::printf("pd1 %p\n", pd1); // 0x??? pd2 = dyn_cast<D2>(b); std::printf("pd2 %p\n", pd2); // 0 std::putchar('\n'); std::printf("d1.ID() = %d, d2.ID() = %d\n", d1.ID(), d2.ID()); Base *b1 = new D1; b1->Destroy(); TestEnd(); }
void ShutdownHook ( StatusType xError) { TestEnd(g_TestResult,TEST_TOTAL); }
void CTextParser::PassPosition(void) { masPositions.Pop(); TestEnd(); }