int __cdecl main(int argc, char *argv[]) { if (0 != PAL_Initialize(argc, argv)) { return FAIL; } if (IsDBCSLeadByteEx(-1, 0)) { Fail("IsDBCSLeadByteEx did not error on an invalid code page!\n"); } /* Clear the last error. */ SetLastError(0); DoTest(0); DoTest(CP_ACP); DoTest(0x4E4); PAL_Terminate(); return PASS; }
static void Display( void ) { if (Interactive) { DoFrame(); glutSwapBuffers(); } else { int success, retry; printf("\nFirst frame\n-----------\n"); DoFrame(); success = DoTest(); glutSwapBuffers(); printf("\nSecond frame\n------------\n"); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glOrtho( 0, 3*(NUM_TESTS+1), -1.5, 1.5, -1, 1 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); DoFrame(); retry = DoTest(); glutSwapBuffers(); if (retry && success) { printf("\nPIGLIT: { 'result': 'pass' }\n"); } else if (retry || success) { printf("\nPIGLIT: { 'result': 'warn', 'note': 'Inconsistent results in first and second frame' }\n"); } else { printf("\nPIGLIT: { 'result': 'fail' }\n"); } exit(0); } }
VOID main() { DbgPrint("Machine\n"); DoTest((HANDLE)REG_LOCAL_MACHINE); DbgPrint("User\n"); DoTest((HANDLE)REG_LOCAL_USER); }
GLDEF_C TInt E32Main() { test.Title(); test.Start(_L("Create chunk")); RChunk c; TInt r=c.CreateDisconnectedLocal(0,0x1000,0x100000); test(r==KErrNone); r=c.Commit(0x10000,0x1000); test(r==KErrNone); TUint8* pBuf1=c.Base(); TUint8* pBuf2=pBuf1+0x10000; TInt s; TInt d; TInt l; for (l=1; l<300; l+=3) { for (s=0; s<=4096-l; s+=227) { test.Printf(_L("\ns=%4d l=%4d: "),s,l); for (d=0; d<=4096-l; d+=229) { DoTest(pBuf1,pBuf2,4096,s,d,l,0); DoTest(pBuf1,pBuf2,4096,s,d,l,1); } } } for (l=1; l<300; l+=3) { for (s=4096-l; s>=0; s-=227) { test.Printf(_L("\ns=%4d l=%4d: "),s,l); for (d=4096-l; d>=0; d-=229) { DoTest(pBuf1,pBuf2,4096,s,d,l,0); DoTest(pBuf1,pBuf2,4096,s,d,l,1); } } } for (l=1; l<400; l+=((l<=64)?1:3) ) { test.Printf(_L("\nOverlap test: l=%4d: "),l); for (s=32; s<=4096-32-l; s+=101) // want s to take all values 0...31 modulo 32 { for (d=s-32; d<=s+32; ++d) { DoOverlapTest(pBuf1,pBuf2,4096,s,d,l); } } } c.Close(); test.End(); return 0; }
int main() { BaseInterface* b1 = DoTest(4.5f); b1->doPrint(); BaseInterface* b2 = DoTest(5); b2->doPrint(); delete b1; delete b2; return 0; }
int main(int argc, char *argv[]) { DoTest(0); DoTest(1); printf("Done.\n"); return 0; }
HRESULT CTestRecvFromEx::Run() { HRESULT hr = S_OK; Chk(DoTest(false)); // ipv4 Chk(DoTest(true)); // ipv6 Cleanup: return hr; }
void UT_Base64_Test(FILE * fp) { #define DoTest(t) #t, UT_TestStatus_GetMessage((t)()) fprintf(fp,"UT_Base64_Test:\n"); fprintf(fp,"\tTest: %s result %s\n", DoTest(t_test_001) ); fprintf(fp,"\tTest: %s result %s\n", DoTest(t_test_002) ); fprintf(fp,"\tTest: %s result %s\n", DoTest(t_test_003) ); // add other base64 tests here }
int main(int argc, char *argv[]) { odbc_connect(); DoTest(0); DoTest(1); odbc_disconnect(); printf("Done.\n"); return 0; }
void ConfiguredActionTest::TestCases() { StartTrace(ConfiguredActionTest.TestCases); Anything testCases; long runOnlySz = GetConfig()["RunOnly"].GetSize(); if (runOnlySz > 0) { String warning; warning << "ConfiguredActionTest not complete : Running only " << runOnlySz << " Testcases"; t_assertm(false, (const char *)warning); for (long i = 0; i < runOnlySz; ++i) { String testCaseName = GetConfig()["RunOnly"][i].AsString("Unknown"); testCases[testCaseName] = GetTestCaseConfig()[testCaseName].DeepClone(); } TraceAny(testCases, "TestCases"); } else { testCases = GetTestCaseConfig().DeepClone(); } long sz = testCases.GetSize(); for (long i = 0; i < sz; ++i) { if (i > 0) { std::cerr << "."; } String testCaseName = testCases.SlotName(i); DoTest(PrepareConfig(testCases[i]), testCaseName); } }
// MixerTest_DoMenuItem() // ----------------------------------------------------- // // void MixerTest_DoMenuItem(int menu, int subMenu) { BAEResult err; err = BAE_NO_ERROR; switch (menu) { case 1: err = DoScript(subMenu); break; case 2: err = DoFunction(subMenu); break; case 3: err = DoTest(subMenu); break; default: break; } if (err) { printf("\a! Error code: %s (%d)\n", BAEResultToStr(err), (int)err); } else { printf("OK.\n"); } }
int DoAllTests(int nN, int *Ns, int nX, int *Xs, int nY, int *Ys) { int in, ix, iy, ia, ib, iret=0, i=0, j, k; char *passfail; char *t1=" ITST N incX TEST"; char *t2="====== ======== ==== ======"; fprintf(stdout, "%s\n", t1); fprintf(stdout, "%s\n", t2); for (in=0; in < nN; in++) { for (ix=0; ix < nX; ix++) { j = DoTest(Ns[in], Xs[ix]); iret += j; if (j == 0) passfail = "PASSED"; else passfail = "FAILED"; fprintf(stdout, "%6d %9d %5d %s\n", i, Ns[in], Xs[ix], passfail); i++; } } if (iret == 0) fprintf(stdout, "ALL ASUM SANITY TESTS PASSED.\n\n"); else fprintf(stdout, "%d of %d ASUM TESTS FAILED!!\n\n", iret, i); return(iret); }
int __cdecl main(int argc,char *argv[]) { char ValidPtr[256]; if(PAL_Initialize(argc, argv)) { return FAIL; } /* with valid pointer, zero-size and valid size must succeed */ DoTest(ValidPtr, 0, 1); DoTest(ValidPtr, 42, 1); PAL_Terminate(); return PASS; }
int main() { DoTest(); cNetworkSingleton::Get().Terminate(); LOGD("Network test finished"); return 0; }
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch (message) { case WM_INITDIALOG: return (INT_PTR)TRUE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: DoTest(hDlg); EndDialog(hDlg, LOWORD(wParam)); break; case IDCANCEL: default: EndDialog(hDlg, LOWORD(wParam)); break; } return (INT_PTR)TRUE; } return (INT_PTR)FALSE; }
int __cdecl main(int argc, char *argv[]) { if (0 != PAL_Initialize(argc,argv)) { return FAIL; } DoTest(szStar, szDot, szDotDot); DoTest(szStarDotStar, szDot, szDotDot); PAL_Terminate(); return PASS; }
int main() { struct sigaction sigact; sigact.sa_sigaction = Handle; sigemptyset(&sigact.sa_mask); sigact.sa_flags = SA_SIGINFO; if (sigaction(SIGSEGV, &sigact, 0) == -1) { fprintf(stderr, "Unable handle SIGSEGV\n"); return 1; } if (sigaction(SIGBUS, &sigact, 0) == -1) { fprintf(stderr, "Unable handle SIGBUS\n"); return 1; } sigsetjmp(JumpBuffer, 1); for (;;) { if (!DoTest(TestNumber)) { printf("Last test\n"); break; } printf("Failed to raise signal\n"); TestNumber++; } return 0; }
bool Test::PerformTest() { printf("\nTEST: %s ...\n", test_name); bool result; _CrtMemState s1, s2, s3; _CrtMemCheckpoint(&s1); result = DoTest(); _CrtMemCheckpoint(&s2); if (_CrtMemDifference(&s3, &s1, &s2)) { result = false; printf("leak detected\n"); _CrtMemDumpStatistics(&s3); } if (result) { printf("RESULT: passed\n"); } else { printf("RESULT: error\n"); } return result; }
int main(int ArgCount, const char** Args) { FILE* Tests; int Expect, Got; char* Result; char* Command; int LineNumber; if(ArgCount != 2) Usage(); Tests = fopen(Args[1], "r"); if(Tests == NULL) { fprintf(stderr, "Can't open '%s' for reading.\n", Args[1]); Usage(); } Result = malloc(MAXLINE+1); assert(Result != NULL); Command = malloc(MAXLINE+1); assert(Command != NULL); for(LineNumber=1; fgets(Command, MAXLINE, Tests); ++LineNumber) { if(!GoodLine(Command)) { fprintf(stderr, "'%s' Line %d: not terminated by newline.\n", Args[1], LineNumber); exit(EXIT_FAILURE); } if(SkipLine(Command)) continue; ++LineNumber; if(fgets(Result, MAXLINE, Tests) && GoodLine(Result)) { Expect = atoi(Result); if(Expect < 0) { fprintf(stderr, "File '%s' Line %d: could not make positive integer out of '%s'\n", Args[1], LineNumber, Result); exit(EXIT_FAILURE); } if(!DoTest(Command, Expect, &Got)) { fprintf(stderr, "File '%s' Line %d: test failed:\n '%s'\n " "Expecting status %d, got %d\n", Args[1], LineNumber, Command, Expect, Got); exit(EXIT_FAILURE); } } else { fprintf(stderr, "'%s' Line %d: not terminated by newline.\n", Args[1], LineNumber); exit(EXIT_FAILURE); } } printf("all regression tests completed successfully!\n"); return EXIT_SUCCESS; }
int __cdecl main(int argc, char *argv[]) { HANDLE hFile = NULL; DWORD dwBytesWritten; if (0 != PAL_Initialize(argc,argv)) { return FAIL; } /* create a test file */ hFile = CreateFile(szTextFile, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if(hFile == INVALID_HANDLE_VALUE) { Fail("SetEndOfFile: ERROR -> Unable to create file \"%s\". " "GetLastError returned %u.\n", szTextFile, GetLastError()); } if (!WriteFile(hFile, szStringTest, strlen(szStringTest), &dwBytesWritten, NULL)) { Trace("SetEndOfFile: ERROR -> Unable to write to \"%s\". ", "GetLastError returned %u.\n", szTextFile, GetLastError()); Cleanup(hFile); Fail(""); } DoTest(hFile, -2, FILE_END); /* test the end */ DoTest(hFile, -10, FILE_CURRENT); /* test the middle-ish */ DoTest(hFile, 0, FILE_BEGIN); /* test the start */ Cleanup(hFile); PAL_Terminate(); return PASS; }
int main() { std::ifstream fin("input.txt"); std::ofstream fout("output.txt"); int num; fin >> num; fout << DoTest(num) << std::endl; return 0; }
void TestRange(int from, int to) { int i; for(i = from ; i <= to ; ++i ) { int status = DoTest(i); totalErrorCodes[status]++; } }
void CFtpTest02::TestMain() { #ifdef __IPV4_TESTS__ iTestParams.SetParams(_L("207.46.133.140"), 21, _L("ftp.microsoft.com"), //params for microsoft ftp site _L8("anonymous"), _L8("*****@*****.**"), _L8("misc"), _L8("index.txt"), _L("index.txt")); DoTest(); iTestParams.SetParams(_L("192.18.99.73"), 21, _L("ftp.sun.com"), _L8("anonymous"), _L8("*****@*****.**"), _L8("/"), _L8("swec.dat"), _L("swec.dat")); DoTest(); #endif #ifdef __FILERETR_TESTS__ iTestParams.SetParams(_L("10.16.113.6"), 21, _L("ftp-images"), _L8("roms"), _L8("integrator"), _L8("/"), _L8("psdagt_udeb.htm"), _L("psdagt_udeb.htm")); iCFTPSession->Connect(iTestParams.iInetAddr,iTestParams.iUserName, //Login using passive mode iTestParams.iPassword,CFTPSession::Epassive); StartScheduler(); RetriveveTestOverwrite(); FailedRetrievalTestOverwrite(); FailedRetrievalTest(); iCFTPSession->Close(); StartScheduler(); #endif #ifdef __IPV6_TESTS__ iTestParams.SetParams(_L("2001:618:400:6a:2c0:4fff:fe8a:a918"), //params for snus6 21, _L("snus6.intra6"), _L8("karlm"), _L8("karlm"), _L8("/usr/home/karlm"), _L8("test.cpp"), _L("test.cpp")); DoTest(); iTestParams.SetParams(_L("2001:618:400:6a:210:5aff:febf:531"), //params for 6pack6 21, _L("6pack6.intra6"), _L8("anonymous"), _L8("karlm"), _L8("/usr"), _L8("anything"), _L("anything")); DoTest(); #endif }
int __cdecl main(int argc, char **argv) { double pi = 3.1415926535; int i; struct test tests[] = { {0, 0, 0}, {0, 1, 0}, {0.104528463, 0.994521895, 0.104719755}, {0.207911691, 0.978147601, 0.20943951}, {0.309016994, 0.951056516, 0.314159265}, {0.406736643, 0.913545458, 0.41887902}, {0.5, 0.866025404, 0.523598776}, {0.587785252, 0.809016994, 0.628318531}, {0.669130606, 0.743144825, 0.733038286}, {0.743144825, 0.669130606, 0.837758041}, {0.809016994, 0.587785252, 0.942477796}, {0.866025404, 0.5, 1.04719755}, {0.913545458, 0.406736643, 1.15191731}, {0.951056516, 0.309016994, 1.25663706}, {0.978147601, 0.207911691, 1.36135682}, {0.994521895, 0.104528463, 1.46607657}, {1, 4.48965922e-011, 1.57079633}, }; if (PAL_Initialize(argc, argv) != 0) { return FAIL; } for( i = 0; i < sizeof(tests) / sizeof(struct test); i++) { DoTest(tests[i].x, tests[i].y, tests[i].result); DoTest(-tests[i].x, tests[i].y, -tests[i].result); DoTest(tests[i].x, -tests[i].y, pi - tests[i].result); DoTest(-tests[i].x, -tests[i].y, tests[i].result - pi); } PAL_Terminate(); return PASS; }
TEST_P(TestModelGenerator2D, Generate) { TiXmlDocument doc; doc.Parse(GetParam().xml.c_str()); TestModelGeneratorWrapper<DefaultGeometry2D> gen(doc.RootElement()); std::string g2 = gen.createG2(GetParam().dim); SIM2D sim; TopologySet sets = gen.createTopologySets(sim); DoTest(GetParam(), g2, sets); }
int __cdecl main(int argc, char *argv[]) { if (PAL_Initialize(argc, argv) != 0) return(FAIL); DoTest("foo %n bar", 4, "foo bar"); DoTest("foo %#n bar", 4, "foo bar"); DoTest("foo % n bar", 4, "foo bar"); DoTest("foo %+n bar", 4, "foo bar"); DoTest("foo %-n bar", 4, "foo bar"); DoTest("foo %0n bar", 4, "foo bar"); DoShortTest("foo %hn bar", 4, "foo bar"); DoTest("foo %ln bar", 4, "foo bar"); DoTest("foo %Ln bar", 4, "foo bar"); DoTest("foo %I64n bar", 4, "foo bar"); DoTest("foo %20.3n bar", 4, "foo bar"); PAL_Terminate(); return PASS; }
enum piglit_result piglit_display(void) { int succ; DoFrame(); succ = DoTest(); piglit_present_results(); return succ ? PIGLIT_PASS : PIGLIT_FAIL; }
int main(int argc, char *argv[]) { char buf1[512]; printf("[s] to sync [a] to async:\n"); gets(buf1); if (buf1[0]=='a') { printf("TestAsync\n"); TestAsync test; DoTest(test); } else { printf("TestSync\n"); TestSync test; DoTest(test); } printf("done.\n"); gets(buf1); }
enum piglit_result piglit_display(void) { bool pass; DoFrame(); pass = DoTest(); piglit_present_results(); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
void CAbstractTest::ThreadEntryPoint() { TRY_CATCH m_messenger->Init(m_testParams, m_connectParams); DoTest(); return; CATCH_LOG() TRY_CATCH RaiseOnComplete(false); CATCH_LOG() }