int main(int argc, char **argv) { int rc = RTTestInitAndCreate("tstRTCritSectRw", &g_hTest); if (rc) return 1; RTTestBanner(g_hTest); if (Test1()) { if (argc == 1) { TestNegative(); /* threads, seconds, writePercent, yield, quiet */ Test4( 1, 1, 0, true, false); Test4( 1, 1, 1, true, false); Test4( 1, 1, 5, true, false); Test4( 2, 1, 3, true, false); Test4( 10, 1, 5, true, false); Test4( 10, 10, 10, false, false); RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "benchmarking...\n"); for (unsigned cThreads = 1; cThreads < 32; cThreads++) Test4(cThreads, 2, 1, false, true); /** @todo add a testcase where some stuff times out. */ } else { /* threads, seconds, writePercent, yield, quiet */ RTTestPrintf(g_hTest, RTTESTLVL_ALWAYS, "benchmarking...\n"); Test4( 1, 3, 1, false, true); Test4( 1, 3, 1, false, true); Test4( 1, 3, 1, false, true); Test4( 2, 3, 1, false, true); Test4( 2, 3, 1, false, true); Test4( 2, 3, 1, false, true); Test4( 3, 3, 1, false, true); Test4( 3, 3, 1, false, true); Test4( 3, 3, 1, false, true); } } return RTTestSummaryAndDestroy(g_hTest); }
int main(int argc, char** argv) { verbose = getenv("PEGASUS_TEST_VERBOSE"); CIMClient client; try { client.connectLocal(); Test1(client); Test2(client); Test3(client); } catch(const CIMException & e) { client.disconnect(); cout << "CIMException: " << e.getCode() << " " << e.getMessage() << endl; return(1); } catch(const Exception & e) { client.disconnect(); cout << "Exception: " << e.getMessage() << endl; return(1); } catch(...) { client.disconnect(); cout << "unknown exception" << endl; return(1); } client.disconnect(); cout << argv[0] << " +++++ passed all tests" << endl; return(0); }
int main(int argc, char * argv[]) { int which; emInitLocale(); emEnableDLog(); if (argc>=2) which=atoi(argv[1]); else which=-1; if (which<0 || which==1) Test1(); if (which<0 || which==2) Test2(); if (which<0 || which==3) Test3(); if (which<0 || which==4) Test4(); if (which<0 || which==5) Test5(); if (which<0 || which==6) Test6(); printf("Success\n"); return 0; }
int main(int argc, char *argv[]) { Print = false; offDump(); offNode(); if (true) Test1(); if (true) Test2(); if (true) Test3(); if (true) Test4(); if (true) Test5(); if (true) Test6(); if (true) Test7(); if (true) Test8(); if (true) Test9(); if (true) Test10(); if (true) Test11(); if (true) Test12(); if (true) Test13(); if (true) Test14(); if (true) Test15(); return 0; }
void TrianglePointInsideTest() { std::cout << std::endl << "TrianglePointInsideTest()" << std::endl << "----------------" << std::endl; //define the triangle with 3 points vgl_point_3d<double> p0(0.0,0.0,0.0); vgl_point_3d<double> p1(1.0,0.0,0.0); vgl_point_3d<double> p2(0.0,1.0,0.0); //create 2 points to test if they are inside the triangle vgl_point_3d<double> Test1(.5,.5,0.0); vgl_point_3d<double> Test2(2.0,2.0,0.0); //perform the tests bool bInside1 = vgl_triangle_3d_test_inside(Test1,p0,p1,p2); bool bInside2 = vgl_triangle_3d_test_inside(Test2,p0,p1,p2); //output the results std::cout << "Inside1 = " << bInside1 << std::endl; std::cout << "Inside2 = " << bInside2 << std::endl; }
bool TestDataStructuresChild::RecvStart() { puts("[TestDataStructuresChild] starting"); Test1(); Test2(); Test3(); Test4(); Test5(); Test6(); Test7_0(); Test7(); Test8(); Test9(); Test10(); Test11(); Test12(); Test13(); Test14(); Test15(); Test16(); Test17(); if (OtherProcess() != 0) { //FIXME/bug 703317 allocation of nsIntRegion uses a global //region pool which breaks threads Test18(); } for (uint32_t i = 0; i < nactors; ++i) if (!PTestDataStructuresSubChild::Send__delete__(mKids[i])) fail("can't send dtor"); Close(); return true; }
int main(int /*argc*/, char* /*argv[]*/) { LPCTSTR pstrCSV = _T("../../data/citylist.csv"); printf("Testing csv..."); CComPtr<IDbSystem> piCsvDbSystem; OpenDbSystem(0, DB_SYSTEM_CVS, &piCsvDbSystem); CsvTest(piCsvDbSystem, pstrCSV); printf("Done.\n"); LPCTSTR pstrDSN = _T("Northwind"); //printf("Testing ODBC..."); CComPtr<IDbSystem> piOdbc; OpenDbSystem(0, DB_SYSTEM_ODBC, &piOdbc); OdbcTest(piOdbc, pstrDSN); //printf("Done.\n"); pstrDSN = _T("Provider=SQLOLEDB;Data Source=(local);Integrated Security=SSPI;Initial Catalog=dcmqrdb"); pstrDSN = _T("Provider=SQLOLEDB;Data Source=167.81.183.231\\SQLEXPRESS;Persist Security Info=True;User ID=t;Password=t"); //printf("Testing ODBC..."); //CAutoPtr<IDbSystem> pODBC(new COdbcSystem()); //Test1(pODBC, pstrDSN); //Test2(pODBC, pstrDSN); //printf("Done.\n"); printf("Testing OLEDB..."); CComPtr<IDbSystem> pOLEDB; OpenDbSystem(0, DB_SYSTEM_OLEDB, &pOLEDB); Test1(pOLEDB, pstrDSN); Test2(pOLEDB, pstrDSN); printf("Done.\n"); return 0; }
/*---------------------------------------------------------------------- | main +---------------------------------------------------------------------*/ int main(int argc, char** argv) { NPT_COMPILER_UNUSED(argc); NPT_HttpRequestHandler *handler, *custom_handler; NPT_Reference<NPT_DataBuffer> buffer; NPT_Size size; bool result; PLT_RingBufferStreamReference ringbuffer_stream(new PLT_RingBufferStream()); /* parse command line */ ParseCommandLine(argv); /* create http server */ PLT_HttpServer http_server(Options.port?Options.port:80); NPT_String url = "http://127.0.0.1:" + NPT_String::FromInteger(http_server.GetPort()); NPT_String custom_url = url; if (!Options.path.IsEmpty()) { /* extract folder path */ int index1 = Options.path.ReverseFind('\\'); int index2 = Options.path.ReverseFind('/'); if (index1 <= 0 && index2 <=0) { fprintf(stderr, "ERROR: invalid path\n"); exit(1); } NPT_DirectoryEntryInfo info; NPT_CHECK_SEVERE(NPT_DirectoryEntry::GetInfo(Options.path, &info)); /* add file request handler */ handler = new NPT_HttpFileRequestHandler( Options.path.Left(index1>index2?index1:index2), "/"); http_server.AddRequestHandler(handler, "/", true); /* build url*/ url += "/" + Options.path.SubString((index1>index2?index1:index2)+1); } else { /* create random data */ buffer = new NPT_DataBuffer(32768); buffer->SetDataSize(32768); /* add static handler */ handler = new NPT_HttpStaticRequestHandler(buffer->GetData(), buffer->GetDataSize(), "text/xml"); http_server.AddRequestHandler(handler, "/test"); /* build url*/ url += "/test"; } /* add custom handler */ NPT_InputStreamReference stream(ringbuffer_stream); custom_handler = new PLT_HttpCustomRequestHandler(stream, "text/xml"); http_server.AddRequestHandler(custom_handler, "/custom"); custom_url += "/custom"; /* start server */ NPT_CHECK_SEVERE(http_server.Start()); /* a task manager for the tests downloader */ PLT_TaskManager task_manager; /* small delay to let the server start */ NPT_System::Sleep(NPT_TimeInterval(1, 0)); /* execute tests */ result = Test1(&task_manager, url.GetChars(), size); if (!result) return -1; result = Test2(&task_manager, url.GetChars(), size); if (!result) return -1; result = Test3(&task_manager, custom_url.GetChars(), ringbuffer_stream, size); if (!result) return -1; NPT_System::Sleep(NPT_TimeInterval(1, 0)); http_server.Stop(); delete handler; delete custom_handler; return 0; }
int _tmain(int argc, _TCHAR* argv[]) { Test1(); return 0; }
int TestMain () { Test1(); // requires malloc initialization so should be first Test2(); TestKeyDtor(); return Harness::Done; }
int main (void){ Test1(1); Test1(4); Test2("qwer"); }
int main() { //Test(); Test1(); return 0; }
TInt E32Main() { TInt r; test.Title(); test.Start(_L("Starting T_DENYCLAMP ...")); test(TheFs.Connect()==KErrNone); GetDriveLetters(); TBuf<256> pathName; //************************************************************************ // // Test on FAT (writable file system) // //************************************************************************ if(NandFatDrv!='?') { pathName=_L("?:\\CLAMP-TST\\"); // FAT on NAND pathName[0]=(TText)NandFatDrv; r=TheFs.MkDirAll(pathName); test(r==KErrNone || r== KErrAlreadyExists); TheFs.SetSessionPath(pathName); test.Printf( _L("T_DENYCLAMP: testing FAT drive on %C\n"),(TText)NandFatDrv); Test1(); // Basic clamp operation Test2(); // Invalid clamp requests // Test3(pathName);// Denied FS requests when files are clamped - invalid for T_DENYCLAMP r=TheFs.RmDir(pathName); test(r==KErrNone); } else test.Printf( _L("T_DENYCLAMP: FAT drive not tested\n")); //************************************************************************ // // Test on ROFS (non-writable file system) // //************************************************************************ if(RofsDrv!='?') { pathName=_L("?:\\"); pathName[0]=(TText)RofsDrv; TheFs.SetSessionPath(pathName); test.Printf( _L("T_DENYCLAMP: testing ROFS drive on %C\n"),(TText)RofsDrv); Test4(pathName); // Clamp tests for non-writable file system } else test.Printf( _L("T_DENYCLAMP: ROFS drive not tested\n")); //************************************************************************ // // Test on Z: - Composite File System, or ROMFS (non-writable file system) // //************************************************************************ if(CompDrv!='?') { pathName=_L("?:\\TEST\\"); pathName[0]=(TText)CompDrv; TheFs.SetSessionPath(pathName); test.Printf( _L("T_DENYCLAMP: testing Z drive (on %C)\n"),(TText)CompDrv); Test4(pathName); // Clamp tests for non-writable file system } else test.Printf( _L("T_DENYCLAMP: Z drive not tested\n")); //************************************************************************ // // Test on LFFS (non-clampable file system) // //************************************************************************ if(LffsDrv!='?') { TBuf<256> unsuppPath; unsuppPath=_L("?:\\CLAMP-TST\\"); unsuppPath[0]=(TText)LffsDrv; r=TheFs.MkDirAll(unsuppPath); test(r==KErrNone || r== KErrAlreadyExists); TheFs.SetSessionPath(unsuppPath); test.Printf( _L("T_DENYCLAMP: testing LFFS drive on %C\n"),(TText)LffsDrv); Test5(); // Clamp requests on non-clamping file systems } else test.Printf( _L("T_DENYCLAMP: LFFS drive not tested\n")); test.End(); return 0; }
int main(){ Test1(); Test2(); Test3(); return 0; }
int main() { Test1(); return 0; }
void DLCSystemTests::StartTests() { Test1(); }
void serialization_test() { std::string file("test"); bool tbIn = true,tbOut; char tcIn = 't',tcOut; unsigned char tucIn = 'u',tucOut; short tsIn = 6,tsOut; int tiIn = -10,tiOut; unsigned int tuiIn = 10,tuiOut; float tfIn = 1.0005,tfOut; double tdIn = 1.000000005,tdOut; int* tinpIn = NULL,*tinpOut = NULL; float* tfpIn = new float,*tfpOut = NULL; *tfpIn = 1.11101; std::string tstrIn("test12345"),tstrOut; Test2 tObjIn,tObjOut; int ti = 2; tObjIn.ti = &ti; Test1 test1,test2,test3; test1.ts = "100"; test2.ts = "200"; test3.ts = "300"; Test1 testA, testC; testA.tt = &test1; testA.ts = "test123"; testA.tvt.push_back(&test2); testA.tvt.push_back(&test3); Test1 testB = testA; testB.ts = "400"; testB.tvt.pop_back(); std::pair<int,bool> tPairIn(10,true); std::pair<int,bool> tPairOut; std::vector<int> tVector1In ={1,2,3,4,5}; std::vector<int> tVector1Out; std::pair<int,bool> p1(10,1); std::pair<int,bool> p2(1,0); std::pair<int,bool> p3(10000,1); std::vector<std::pair<int,bool> > tVector2In ={p1,p2,p3}; std::vector<std::pair<int,bool> > tVector2Out; std::set<std::pair<int,bool> > tSetIn ={p1,p2,p3}; std::set<std::pair<int,bool> > tSetOut; std::map<int,bool> tMapIn ={p1,p2,p3}; std::map<int,bool> tMapOut; Eigen::Matrix<float,3,3> tDenseMatrixIn; tDenseMatrixIn << Eigen::Matrix<float,3,3>::Random(); tDenseMatrixIn.coeffRef(0,0) = 1.00001; Eigen::Matrix<float,3,3> tDenseMatrixOut; Eigen::Matrix<float,3,3,Eigen::RowMajor> tDenseRowMatrixIn; tDenseRowMatrixIn << Eigen::Matrix<float,3,3,Eigen::RowMajor>::Random(); Eigen::Matrix<float,3,3,Eigen::RowMajor> tDenseRowMatrixOut; Eigen::SparseMatrix<double> tSparseMatrixIn; tSparseMatrixIn.resize(3,3); tSparseMatrixIn.insert(0,0) = 1.3; tSparseMatrixIn.insert(1,1) = 10.2; tSparseMatrixIn.insert(2,2) = 100.1; tSparseMatrixIn.finalize(); Eigen::SparseMatrix<double> tSparseMatrixOut; // binary serialization igl::serialize(tbIn,file); igl::deserialize(tbOut,file); assert(tbIn == tbOut); igl::serialize(tcIn,file); igl::deserialize(tcOut,file); assert(tcIn == tcOut); igl::serialize(tucIn,file); igl::deserialize(tucOut,file); assert(tucIn == tucOut); igl::serialize(tsIn,file); igl::deserialize(tsOut,file); assert(tsIn == tsOut); igl::serialize(tiIn,file); igl::deserialize(tiOut,file); assert(tiIn == tiOut); igl::serialize(tuiIn,file); igl::deserialize(tuiOut,file); assert(tuiIn == tuiOut); igl::serialize(tfIn,file); igl::deserialize(tfOut,file); assert(tfIn == tfOut); igl::serialize(tdIn,file); igl::deserialize(tdOut,file); assert(tdIn == tdOut); igl::serialize(tinpIn,file); igl::deserialize(tinpOut,file); assert(tinpIn == tinpOut); igl::serialize(tfpIn,file); igl::deserialize(tfpOut,file); assert(*tfpIn == *tfpOut); tfpOut = NULL; igl::serialize(tstrIn,file); igl::deserialize(tstrOut,file); assert(tstrIn == tstrOut); // updating igl::serialize(tbIn,"tb",file,true); igl::serialize(tcIn,"tc",file); igl::serialize(tiIn,"ti",file); tiIn++; igl::serialize(tiIn,"ti",file); tiIn++; igl::serialize(tiIn,"ti",file); igl::deserialize(tbOut,"tb",file); igl::deserialize(tcOut,"tc",file); igl::deserialize(tiOut,"ti",file); assert(tbIn == tbOut); assert(tcIn == tcOut); assert(tiIn == tiOut); igl::serialize(tsIn,"tsIn",file,true); igl::serialize(tVector1In,"tVector1In",file); igl::serialize(tVector2In,"tsIn",file); igl::deserialize(tVector2Out,"tsIn",file); for(unsigned int i=0;i<tVector2In.size();i++) { assert(tVector2In[i].first == tVector2Out[i].first); assert(tVector2In[i].second == tVector2Out[i].second); } tVector2Out.clear(); igl::serialize(tObjIn,file); igl::deserialize(tObjOut,file); assert(tObjIn.tc == tObjOut.tc); assert(*tObjIn.ti == *tObjOut.ti); for(unsigned int i=0;i<tObjIn.tvb.size();i++) assert(tObjIn.tvb[i] == tObjOut.tvb[i]); tObjOut.ti = NULL; igl::serialize(tPairIn,file); igl::deserialize(tPairOut,file); assert(tPairIn.first == tPairOut.first); assert(tPairIn.second == tPairOut.second); igl::serialize(tVector1In,file); igl::deserialize(tVector1Out,file); for(unsigned int i=0;i<tVector1In.size();i++) assert(tVector1In[i] == tVector1Out[i]); igl::serialize(tVector2In,file); igl::deserialize(tVector2Out,file); for(unsigned int i=0;i<tVector2In.size();i++) { assert(tVector2In[i].first == tVector2Out[i].first); assert(tVector2In[i].second == tVector2Out[i].second); } igl::serialize(tSetIn,file); igl::deserialize(tSetOut,file); assert(tSetIn.size() == tSetOut.size()); igl::serialize(tMapIn,file); igl::deserialize(tMapOut,file); assert(tMapIn.size() == tMapOut.size()); igl::serialize(tDenseMatrixIn,file); igl::deserialize(tDenseMatrixOut,file); assert((tDenseMatrixIn - tDenseMatrixOut).sum() == 0); igl::serialize(tDenseRowMatrixIn,file); igl::deserialize(tDenseRowMatrixOut,file); assert((tDenseRowMatrixIn - tDenseRowMatrixOut).sum() == 0); igl::serialize(tSparseMatrixIn,file); igl::deserialize(tSparseMatrixOut,file); assert((tSparseMatrixIn - tSparseMatrixOut).sum() == 0); igl::serialize(testB,file); igl::deserialize(testC,file); assert(testB.ts == testC.ts); assert(testB.tvt.size() == testC.tvt.size()); for(unsigned int i=0;i<testB.tvt.size();i++) { assert(testB.tvt[i]->ts == testC.tvt[i]->ts); assert(testB.tvt[i]->tvt.size() == testC.tvt[i]->tvt.size()); assert(testB.tvt[i]->tt == testC.tvt[i]->tt); } assert(testB.tt->ts == testC.tt->ts); assert(testB.tt->tvt.size() == testC.tt->tvt.size()); assert(testB.tt->tt == testC.tt->tt); testC = Test1(); // big data test /*std::vector<std::vector<float> > bigDataIn,bigDataOut; for(unsigned int i=0;i<10000;i++) { std::vector<float> v; for(unsigned int j=0;j<10000;j++) { v.push_back(j); } bigDataIn.push_back(v); } igl::Timer timer; timer.start(); igl::serialize(bigDataIn,file); timer.stop(); std::cout << "ser: " << timer.getElapsedTimeInMilliSec() << std::endl; timer.start(); igl::deserialize(bigDataOut,file); timer.stop(); std::cout << "des: " << timer.getElapsedTimeInMilliSec() << std::endl; char c; std::cin >> c; */ // xml serialization igl::serialize_xml(tbIn,file); igl::deserialize_xml(tbOut,file); assert(tbIn == tbOut); igl::serialize_xml(tcIn,file); igl::deserialize_xml(tcOut,file); assert(tcIn == tcOut); igl::serialize_xml(tucIn,file); igl::deserialize_xml(tucOut,file); assert(tucIn == tucOut); igl::serialize_xml(tsIn,file); igl::deserialize_xml(tsOut,file); assert(tsIn == tsOut); igl::serialize_xml(tiIn,file); igl::deserialize_xml(tiOut,file); assert(tiIn == tiOut); igl::serialize_xml(tuiIn,file); igl::deserialize_xml(tuiOut,file); assert(tuiIn == tuiOut); igl::serialize_xml(tfIn,file); igl::deserialize_xml(tfOut,file); assert(tfIn == tfOut); igl::serialize_xml(tdIn,file); igl::deserialize_xml(tdOut,file); assert(tdIn == tdOut); igl::serialize_xml(tinpIn,file); igl::deserialize_xml(tinpOut,file); assert(tinpIn == tinpOut); igl::serialize_xml(tfpIn,file); igl::deserialize_xml(tfpOut,file); assert(*tfpIn == *tfpOut); igl::serialize_xml(tstrIn,file); igl::deserialize_xml(tstrOut,file); assert(tstrIn == tstrOut); // updating igl::serialize_xml(tbIn,"tb",file,false,true); igl::serialize_xml(tcIn,"tc",file); igl::serialize_xml(tiIn,"ti",file); tiIn++; igl::serialize_xml(tiIn,"ti",file); tiIn++; igl::serialize_xml(tiIn,"ti",file); igl::deserialize_xml(tbOut,"tb",file); igl::deserialize_xml(tcOut,"tc",file); igl::deserialize_xml(tiOut,"ti",file); assert(tbIn == tbOut); assert(tcIn == tcOut); assert(tiIn == tiOut); igl::serialize_xml(tsIn,"tsIn",file,false,true); igl::serialize_xml(tVector1In,"tVector1In",file); igl::serialize_xml(tVector2In,"tsIn",file); igl::deserialize_xml(tVector2Out,"tsIn",file); for(unsigned int i=0;i<tVector2In.size();i++) { assert(tVector2In[i].first == tVector2Out[i].first); assert(tVector2In[i].second == tVector2Out[i].second); } tVector2Out.clear(); // binarization igl::serialize_xml(tVector2In,"tVector2In",file,true); igl::deserialize_xml(tVector2Out,"tVector2In",file); for(unsigned int i=0;i<tVector2In.size();i++) { assert(tVector2In[i].first == tVector2Out[i].first); assert(tVector2In[i].second == tVector2Out[i].second); } igl::serialize_xml(tObjIn,file); igl::deserialize_xml(tObjOut,file); assert(tObjIn.tc == tObjOut.tc); assert(*tObjIn.ti == *tObjOut.ti); for(unsigned int i=0;i<tObjIn.tvb.size();i++) assert(tObjIn.tvb[i] == tObjOut.tvb[i]); igl::serialize_xml(tPairIn,file); igl::deserialize_xml(tPairOut,file); assert(tPairIn.first == tPairOut.first); assert(tPairIn.second == tPairOut.second); igl::serialize_xml(tVector1In,file); igl::deserialize_xml(tVector1Out,file); for(unsigned int i=0;i<tVector1In.size();i++) assert(tVector1In[i] == tVector1Out[i]); igl::serialize_xml(tVector2In,file); igl::deserialize_xml(tVector2Out,file); for(unsigned int i=0;i<tVector2In.size();i++) { assert(tVector2In[i].first == tVector2Out[i].first); assert(tVector2In[i].second == tVector2Out[i].second); } igl::serialize_xml(tSetIn,file); igl::deserialize_xml(tSetOut,file); assert(tSetIn.size() == tSetOut.size()); igl::serialize_xml(tMapIn,file); igl::deserialize_xml(tMapOut,file); assert(tMapIn.size() == tMapOut.size()); igl::serialize_xml(tDenseMatrixIn,file); igl::deserialize_xml(tDenseMatrixOut,file); assert((tDenseMatrixIn - tDenseMatrixOut).sum() == 0); igl::serialize_xml(tDenseRowMatrixIn,file); igl::deserialize_xml(tDenseRowMatrixOut,file); assert((tDenseRowMatrixIn - tDenseRowMatrixOut).sum() == 0); igl::serialize_xml(tSparseMatrixIn,file); igl::deserialize_xml(tSparseMatrixOut,file); assert((tSparseMatrixIn - tSparseMatrixOut).sum() == 0); igl::serialize_xml(testB,file); igl::deserialize_xml(testC,file); assert(testB.ts == testC.ts); assert(testB.tvt.size() == testC.tvt.size()); for(unsigned int i=0;i<testB.tvt.size();i++) { assert(testB.tvt[i]->ts == testC.tvt[i]->ts); assert(testB.tvt[i]->tvt.size() == testC.tvt[i]->tvt.size()); assert(testB.tvt[i]->tt == testC.tvt[i]->tt); } assert(testB.tt->ts == testC.tt->ts); assert(testB.tt->tvt.size() == testC.tt->tvt.size()); assert(testB.tt->tt == testC.tt->tt); // big data test /*std::vector<std::vector<float> > bigDataIn,bigDataOut; for(unsigned int i=0;i<10000;i++) { std::vector<float> v; for(unsigned int j=0;j<10000;j++) { v.push_back(j); } bigDataIn.push_back(v); } igl::Timer timer; timer.start(); igl::serialize_xml(bigDataIn,"bigDataIn",file,igl::SERIALIZE_BINARY); timer.stop(); std::cout << "ser: " << timer.getElapsedTimeInMilliSec() << std::endl; timer.start(); igl::deserialize_xml(bigDataOut,"bigDataIn",file); timer.stop(); std::cout << "des: " << timer.getElapsedTimeInMilliSec() << std::endl; char c; std::cin >> c;*/ std::cout << "All tests run successfully!\n"; }
E h = E(); } namespace BaseClass { template<typename T, unsigned> struct X : T {}; struct C { char c = 1; }; template<unsigned... Ns> struct Cs : X<C,Ns>... {}; struct N { int n = 3; }; struct D { double d = 4.0; }; template<typename ...Ts> struct Test : Ts... { constexpr Test() : Ts()..., n(5) {} int n; }; using Test1 = Test<N, C, Cs<1,2>, D, X<C,1>>; // CHECK: @_ZN9BaseClass2t1E = constant {{.*}} { i32 3, i8 1, i8 1, i8 1, double 4.000000e+00, i8 1, i32 5 }, align 8 extern constexpr Test1 t1 = Test1(); struct DN : D, N {}; struct DND : DN, X<D,0> {}; struct DNN : DN, X<N,0> {}; // CHECK: @_ZN9BaseClass3dndE = constant {{.*}} { double 4.000000e+00, i32 3, double 4.000000e+00 } extern constexpr DND dnd = DND(); // Note, N subobject is laid out in DN subobject's tail padding. // CHECK: @_ZN9BaseClass3dnnE = constant {{.*}} { double 4.000000e+00, i32 3, i32 3 } extern constexpr DNN dnn = DNN(); struct E {}; struct Test2 : X<E,0>, X<E,1>, X<E,2>, X<E,3> {}; // CHECK: @_ZN9BaseClass2t2E = constant {{.*}} undef extern constexpr Test2 t2 = Test2();
void TestCase_1() { degrees = { 100, 200, 400, 800, 1600, 3200 }; Test1(1, 1); }
test_F RandomNumberGenerator() { Test1(); Test2(); }
void TestCase_2() { degrees = { 101, 201, 401, 801, 1601, 3201 }; Test1(1, 1); }
/*---------------------------------------------------------------------- | main +---------------------------------------------------------------------*/ int main(int argc, char** argv) { NPT_COMPILER_UNUSED(argc); NPT_HttpRequestHandler* handler; NPT_Reference<NPT_DataBuffer> buffer; bool result; /* parse command line */ ParseCommandLine(argv); /* create http server */ PLT_HttpServer http_server(Options.port?Options.port:8089); NPT_String url; if (!Options.path.IsEmpty()) { /* extract folder path */ int index1 = Options.path.ReverseFind('\\'); int index2 = Options.path.ReverseFind('/'); if (index1 <= 0 && index2 <=0) { fprintf(stderr, "ERROR: invalid path\n"); exit(1); } NPT_FileInfo info; NPT_CHECK_SEVERE(NPT_File::GetInfo(Options.path, &info)); /* add file request handler */ handler = new NPT_HttpFileRequestHandler( Options.path.Left(index1>index2?index1:index2), "/"); http_server.AddRequestHandler(handler, "/", true); /* build url */ url = "/" + Options.path.SubString((index1>index2?index1:index2)+1); } else { /* create random garbage data */ buffer = new NPT_DataBuffer(32768); buffer->SetDataSize(32768); /* add static handler */ handler = new NPT_HttpStaticRequestHandler(buffer->GetData(), buffer->GetDataSize(), "application/octet-stream"); http_server.AddRequestHandler(handler, "/test"); /* build url */ url = "/test"; } /* add custom handler */ PLT_RingBufferStreamReference ringbuffer_stream(new PLT_RingBufferStream()); NPT_InputStreamReference stream(ringbuffer_stream); NPT_HttpRequestHandler* custom_handler = new PLT_HttpCustomRequestHandler(stream, "text/xml"); http_server.AddRequestHandler(custom_handler, "/custom"); /* start server */ NPT_CHECK_SEVERE(http_server.Start()); /* a task manager for the tests downloader */ PLT_TaskManager task_manager; /* small delay to let the server start */ NPT_System::Sleep(NPT_TimeInterval(1.f)); /* execute tests */ NPT_Size size; NPT_COMPILER_UNUSED(size); #ifdef TEST1 result = Test1(&task_manager, NPT_HttpUrl("127.0.0.1", http_server.GetPort(), url), size); if (!result) return -1; #endif #ifdef TEST2 result = Test2(&task_manager, NPT_HttpUrl("127.0.0.1", http_server.GetPort(), url), size); if (!result) return -1; #endif #ifdef TEST3 result = Test3(&task_manager, NPT_HttpUrl("127.0.0.1", http_server.GetPort(), "/custom"), ringbuffer_stream, size); if (!result) return -1; #endif #ifdef TEST4 result = Test4(&task_manager, NPT_HttpUrl("127.0.0.1", http_server.GetPort(), "/custom"), NPT_TimeInterval(.1f)); if (!result) return -1; result = Test4(&task_manager, NPT_HttpUrl("127.0.0.1", http_server.GetPort(), "/custom"), NPT_TimeInterval(1.f)); if (!result) return -1; result = Test4(&task_manager, NPT_HttpUrl("127.0.0.1", http_server.GetPort(), "/custom"), NPT_TimeInterval(2.f)); if (!result) return -1; #endif #ifdef TEST5 result = Test5(NPT_HttpUrl("127.0.0.1", http_server.GetPort(), "/test")); if (!result) return -1; #endif NPT_System::Sleep(NPT_TimeInterval(1.f)); // abort server tasks that are waiting on ring buffer stream ringbuffer_stream->Abort(); http_server.Stop(); return 0; }
int main(int argc, char **argv) { int rc = RTR3Init(); if (RT_FAILURE(rc)) { RTPrintf("tstSemMutex: RTR3Init failed (rc=%Rrc)\n", rc); return 1; } RTPrintf("tstSemMutex: TESTING...\n"); if (argc == 1) { /* threads, seconds, yield, quiet */ Test1( 1, 1, true, false); Test1( 2, 1, true, false); Test1( 10, 1, true, false); Test1( 10, 10, false, false); RTPrintf("tstSemMutex: benchmarking...\n"); for (unsigned cThreads = 1; cThreads < 32; cThreads++) Test1(cThreads, 2, false, true); /** @todo add a testcase where some stuff times out. */ } else { /* threads, seconds, yield, quiet */ RTPrintf("tstSemMutex: benchmarking...\n"); Test1( 1, 3, false, true); Test1( 1, 3, false, true); Test1( 1, 3, false, true); Test1( 2, 3, false, true); Test1( 2, 3, false, true); Test1( 2, 3, false, true); Test1( 3, 3, false, true); Test1( 3, 3, false, true); Test1( 3, 3, false, true); } if (!g_cErrors) RTPrintf("tstSemMutex: SUCCESS\n"); else RTPrintf("tstSemMutex: FAILURE - %u errors\n", g_cErrors); return g_cErrors != 0; }
int main(int argc, char *argv[]) { int ch, error; int my_rank, num_ranks; int msg_len; int num_msgs; int i; double duration; double total_time; int start_rank; int stride; int num_sender; int stat_mode; double req_precision; int ii; double precision; int trials; double tot; double tot_squared; double avg_bisection_rate; double metric; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); MPI_Comm_size(MPI_COMM_WORLD, &num_ranks); if (num_ranks < 2) { if (my_rank == 0) { fprintf(stderr, "Need to run on at least two ranks; more would be better\n"); } MPI_Finalize(); exit(-1); } if (num_ranks % 2 != 0) { if (my_rank == 0) { fprintf(stderr, "Need to run on an even number of ranks\n"); } MPI_Finalize(); exit(-1); } /* Set the defaults */ opterr= 0; /* Disable getopt error printing */ error= FALSE; num_msgs= DEFAULT_NUM_MSGS; msg_len= DEFAULT_MSG_LEN; start_rank= num_ranks / 2; stride= DEFAULT_STRIDE; stat_mode= FALSE; req_precision= 0.01; /* Check command line args */ while ((ch= getopt(argc, argv, ":l:n:s:i:p:t")) != EOF) { switch (ch) { case 'l': msg_len= strtol(optarg, (char **)NULL, 0); if (msg_len < 0) { if (my_rank == 0) { fprintf(stderr, "message length (-l) must be >= 0!\n"); } error= TRUE; } if (msg_len > MAX_MSG_LEN) { if (my_rank == 0) { fprintf(stderr, "message length (-l) must be <= %d!\n", MAX_MSG_LEN); } error= TRUE; } break; case 'n': num_msgs= strtol(optarg, (char **)NULL, 0); if (num_msgs < 1) { if (my_rank == 0) { fprintf(stderr, "Number of messages (-n) must be > 0!\n"); } error= TRUE; } break; case 's': start_rank= strtol(optarg, (char **)NULL, 0); if ((start_rank < 1) || (start_rank > num_ranks)) { if (my_rank == 0) { fprintf(stderr, "Start node (-s) must be > 0 and < n - 1!\n"); } error= TRUE; } break; case 'i': stride= strtol(optarg, (char **)NULL, 0); if ((stride < 1) || (stride > num_ranks)) { if (my_rank == 0) { fprintf(stderr, "Node stride (-i) must be > 0 and < n - 1!\n"); } error= TRUE; } break; case 'p': req_precision= strtod(optarg, (char **)NULL); if (my_rank == 0) { printf("# req_precision is %f\n", req_precision); } break; case 't': stat_mode= TRUE; break; /* Command line error checking */ DEFAULT_CMD_LINE_ERR_CHECK } } if (num_msgs < 2) { if (my_rank == 0) { fprintf(stderr, "Number of messages must be > 1; e.g., %d\n", DEFAULT_NUM_MSGS); } error= TRUE; } if (error) { if (my_rank == 0) { usage(argv[0], num_ranks / 2); } MPI_Finalize(); exit (-1); } if (my_rank == 0) { printf("Message Rate Pattern\n"); printf("--------------------\n"); printf("Command line \""); for (i= 0; i < argc; i++) { printf("%s", argv[i]); if (i < (argc - 1)) { printf(" "); } } printf("\"\n"); } num_sender= num_ranks / 2; ii= 0; if (stat_mode) { trials= 10000; } else { trials= 20; } tot= 0.0; tot_squared= 0.0; while (ii < trials) { duration = Test1(my_rank, num_ranks, num_msgs, msg_len); MPI_Allreduce(&duration, &total_time, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); avg_bisection_rate= 1.0 / ((total_time / (num_ranks / 2)) / num_msgs); tot= tot + avg_bisection_rate; tot_squared= tot_squared + avg_bisection_rate * avg_bisection_rate; precision= stat_p(ii + 1, tot, tot_squared); if (stat_mode) { /* check for precision if at least 3 trials have taken place. ii > 1 => N > 2. */ if (my_rank == 0 && ii > 1 && precision <= req_precision) { trials= ii; } MPI_Bcast(&trials, 1, MPI_INT, 0, MPI_COMM_WORLD); } ii++; } if (stat_mode) { /* if i = 10, actual trials done is 11 */ trials++; /* this is the total number of trials that took place */ } if (my_rank == 0) { printf("# ||| Test 1: Ranks 0...%d will send %d messages of length %d to " "ranks %d...%d along %d paths\n", num_ranks / 2 - 1, num_msgs, msg_len, num_ranks / 2, num_ranks - 1, num_ranks / 2); printf("# ||| Test 1: %d senders, %d receivers\n", num_sender, num_sender); printf("# ||| Test 1: Average bi-section rate: %8.0f msgs/s\n", tot/trials ); printf("# ||| Test 1: Precision of %f, averaged over %d trials\n", precision, trials ); } num_sender= ((num_ranks - start_rank) / stride); if ((num_ranks - start_rank) % stride != 0) { num_sender++; } ii= 0; if (stat_mode) { trials= 10000; } else { trials= 20; } tot= 0.0; tot_squared= 0.0; while (ii < trials) { duration= Test2(my_rank, num_ranks, num_msgs, msg_len, start_rank, stride); MPI_Allreduce(&duration, &total_time, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); metric= 1.0 / ((total_time / num_sender) / (num_msgs - 1)); tot= tot + metric; tot_squared= tot_squared + metric*metric; precision= stat_p(ii + 1, tot, tot_squared); if (stat_mode) { /* check for precision if at least 3 trials have taken place. ii > 1 => N > 2. */ if (my_rank == 0 && ii > 1 && precision <= req_precision) { trials= ii; } MPI_Bcast(&trials, 1, MPI_INT, 0, MPI_COMM_WORLD); } ii++; } if (stat_mode) { /* if i = 10, actual trials done is 11 */ trials++; /* this is the total number of trials that took place */ } if (my_rank == 0) { printf("# ||| Test 2: Rank 0 will send %d messages of length %d to ranks %d...%d, stride %d\n", num_msgs, msg_len, start_rank, num_ranks - 1, stride); printf("# ||| Test 2: %d receivers\n", num_sender); printf("# ||| Test 2: Average send rate: %8.0f msgs/s\n", tot/trials ); printf("# ||| Test 2: Precision of %f, averaged over %d trials\n", precision, trials ); } ii= 0; if (stat_mode) { trials= 10000; } else { trials= 20; } tot= 0.0; tot_squared= 0.0; while (ii < trials) { duration= Test3(my_rank, num_ranks, num_msgs, msg_len, start_rank, stride); MPI_Allreduce(&duration, &total_time, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); metric= 1.0 / (total_time / (num_msgs * num_sender - 1)); tot= tot + metric; tot_squared= tot_squared + metric * metric; precision= stat_p(ii + 1, tot, tot_squared); if (stat_mode) { /* check for precision if at least 3 trials have taken place. ii > 1 => N > 2. */ if (my_rank == 0 && ii > 1 && precision <= req_precision) { trials = ii; } MPI_Bcast(&trials, 1, MPI_INT, 0, MPI_COMM_WORLD); } ii++; } if (stat_mode) { /* if i = 10, actual trials done is 11 */ trials++; /* this is the total number of trials that took place */ } if (my_rank == 0) { printf("# ||| Test 3: Ranks %d...%d, stride %d, will send %d messages of length %d to rank 0\n", start_rank, num_ranks - 1, stride, num_msgs, msg_len); printf("# ||| Test 3: %d senders\n", num_sender); printf("# ||| Test 3: Average receive rate: %8.0f msgs/s\n", tot/trials); printf("# ||| Test 3: Precision of %f, averaged over %d trials\n", precision, trials ); } MPI_Finalize(); return 0; } /* end of main() */
int main() { Test1(); system("pause"); return 0; }
int test_list() { if (sort_test()) return 1; List<A> a_list; a_list.add(A(1, 2)); a_list.add(A(2, 3)); a_list.add(A(3, 4)); CHECK(a_list.get_item_count() == 3); CHECK(a_list.contains(A(2, 3))); CHECK(!a_list.contains(A(7, 8))); A a; CHECK(YETI_SUCCEEDED(a_list.pop_head(a))); CHECK(a == A(1, 2)); CHECK(a_list.get_item_count() == 2); CHECK(YETI_SUCCEEDED(a_list.get(0, a))); CHECK(a == A(2, 3)); A * pa = NULL; CHECK(YETI_SUCCEEDED(a_list.get(0, pa))); CHECK(pa != NULL); CHECK(*pa == A(2, 3)); CHECK(a_list.get_item(1) == ++a_list.get_first_item()); a_list.clear(); CHECK(a_list.get_item_count() == 0); a_list.insert(a_list.get_first_item(), A(7, 9)); CHECK(a_list.get_item_count() == 1); CHECK(*a_list.get_first_item() == A(7, 9)); a_list.add(A(1, 2)); CHECK(a_list.get_item_count() == 2); //CHECK(g_count == 3); CHECK(*a_list.get_first_item() == A(7, 9)); CHECK(*a_list.get_last_item() == A(1, 2)); a_list.insert(a_list.get_last_item(), A(3, 4)); CHECK(a_list.get_item_count() == 3); CHECK(*a_list.get_last_item() == A(1, 2)); g_apply_counter = 0; bool applied; YETI_Result res = a_list.apply_until(Test1(), UnitlResultEquals(YETI_ERROR_OUT_OF_MEMORY), &applied); CHECK(applied == true); CHECK(res == YETI_SUCCESS); CHECK(g_apply_counter == 2); g_apply_counter = 0; res = a_list.apply_until(Test1(), UnitlResultEquals(YETI_FAILURE), &applied); CHECK(applied == false); CHECK(res == YETI_SUCCESS); CHECK(g_apply_counter == 3); a_list.insert(List<A>::iterator(NULL), A(3, 4)); CHECK(a_list.get_item_count() == 4); CHECK(*a_list.get_last_item() == A(3, 4)); a_list.insert(a_list.get_first_item(), A(7, 8)); CHECK(a_list.get_item_count() == 5); CHECK(*a_list.get_first_item() == A(7, 8)); a_list.insert(a_list.get_item(2), A(9, 10)); CHECK(a_list.get_item_count() == 6); CHECK(*a_list.get_item(2) == A(9, 10)); a_list.erase(a_list.get_item(1)); CHECK(a_list.get_item_count() == 5); CHECK(*a_list.get_item(1) == A(9, 10)); //CHECK(g_count == 1 + a_list.get_item_count()); List<int> i1_list; List<int> i2_list; CHECK(i1_list == i2_list); i1_list.add(3); CHECK(i1_list != i2_list); CHECK(!(i1_list == i2_list)); i2_list.add(3); CHECK(i1_list == i2_list); i2_list.add(4); CHECK(i1_list != i2_list); i1_list.add(4); i1_list.add(5); i2_list.add(6); CHECK(i1_list != i2_list); return 0; }