这篇教程C++ tester函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tester函数的典型用法代码示例。如果您正苦于以下问题:C++ tester函数的具体用法?C++ tester怎么用?C++ tester使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tester函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: TESTTEST(SaturationEffectTest, SaturationZeroRemovesColorButPreservesAlpha) { float data[] = { 0.0f, 0.0f, 0.0f, 1.0f, 0.5f, 0.5f, 0.5f, 0.3f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.7f, 0.0f, 0.0f, 1.0f, 1.0f, }; float expected_data[] = { 0.0f, 0.0f, 0.0f, 1.0f, 0.5f, 0.5f, 0.5f, 0.3f, 0.2126f, 0.2126f, 0.2126f, 1.0f, 0.7152f, 0.7152f, 0.7152f, 0.7f, 0.0722f, 0.0722f, 0.0722f, 1.0f, }; float out_data[5 * 4]; EffectChainTester tester(data, 5, 1, FORMAT_RGBA_POSTMULTIPLIED_ALPHA, COLORSPACE_sRGB, GAMMA_LINEAR); Effect *saturation_effect = tester.get_chain()->add_effect(new SaturationEffect()); ASSERT_TRUE(saturation_effect->set_float("saturation", 0.0f)); tester.run(out_data, GL_RGBA, COLORSPACE_sRGB, GAMMA_LINEAR); expect_equal(expected_data, out_data, 4, 5);}
开发者ID:mcanthony,项目名称:movit,代码行数:24,
示例2: TESTTEST(Ref_count_tests, default_return_0) { reference_counted<int> tester(42); ASSERT_EQ(0, tester.get_number_of_references());}
开发者ID:jumonza,项目名称:DevelopingConcurrentSoftware,代码行数:4,
示例3: mainint main(){ return tester();}
开发者ID:SylvainPlessis,项目名称:compta,代码行数:4,
示例4: mainint main(int argc, char* argv[]){ Pooma::initialize(argc,argv); Pooma::Tester tester(argc,argv); int test_number = 0;#if POOMA_EXCEPTIONS try {#endif tester.out() << "/nTesting resizable DataBlockPtr." << std::endl; RCBlock_t p; p.reserve(100); PAssert(p.size() == 0); PAssert(p.capacity() == 100); PAssert(p.empty()); p.resize(10,RCBlock_t::NoInitTag()); p.resize(20); p.resize(30,100); p.resize(10); PAssert(p.size() == 10); PAssert(!p.empty()); RCBlock_t q(100,RCBlock_t::NoInitTag()); PAssert(q.size() == 0); PAssert(q.capacity() == 100); PAssert(q.empty()); q.resize(10,RCBlock_t::NoInitTag()); q.resize(20); q.resize(30,100); q.resize(10); PAssert(q.size() == 10); PAssert(!q.empty()); RCBlock_t bb(100); PAssert(bb.size() == 100); PAssert(bb.capacity() == 100); PAssert(!bb.empty()); bb.resize(10,10); bb.resize(5,5); bb.resize(0); PAssert(bb.empty()); bb.resize(10); test_number++; PAssert(!p.isShared()); PAssert(!q.isShared()); PAssert(!bb.isShared()); test_number++; for (int i = 0; i < 10; i++) p[i] = (i-5)*(i-5); test_number++; print(p,tester); print(q,tester); print(bb,tester);#if POOMA_EXCEPTIONS test_number++; try { for (int i = 0; i < 11; i++) p[i] = -p[i]; throw "Bounds checking failed!"; } catch(const Pooma::Assertion &) { tester.out() << "Bounds check worked." << std::endl; }#endif test_number++; for (int i = 0; i < 10; i++) PInsist( p[i] == *(p+i), "p[i] != *(p+i)" ); for (int i = 0; i < 10; i++) PInsist( p[i] == *(p+i), "p[i] != *(p+i)" ); test_number++;//.........这里部分代码省略.........
开发者ID:pathscale,项目名称:freepooma-testsuite,代码行数:101,
示例5: mainint main(void){ unsigned i, j, esize, cycle, x = 0; _SPM unsigned * elem; SPM_BTE_Buffer bte; const unsigned check = 0xbeef0000; unsigned run_limit = 1000;#ifdef PATMOS data_spm = SPM_BASE;#endif /* Always call spm_init as a first step */ spm_init(); printf("SPM location 0x%x/n", (unsigned) DATA_SPM_BASE); printf("off_chip location 0x%x size %u words/n", (unsigned) off_chip, MAX_TEST_SIZE); printf("Expected SPM size: %u words, %u bytes/n", DATA_SPM_WORDS, DATA_SPM_SIZE); spm_size_test(); printf("basic tests/n"); tester(0, 1024, 4, 1024); tester(0, 1, 4, 1024); tester(1, 1024, 4, 1024); tester(0, 1, 8, 512); mysrand(1000); for (cycle = 0; cycle < 100; cycle++) { do { esize = 1 << (myrand() % 8); } while (((DATA_SPM_SIZE / 2) % (esize * 4)) != 0); printf("%u writing test pattern, element size %u/n", cycle, esize); for (i = MAX_ITEMS; i < (MAX_ITEMS + (DATA_SPM_WORDS * 2)); i++) { off_chip[i] = check | i; } elem = spm_bte_init(&bte, off_chip, data_spm, DATA_SPM_SIZE, esize * 4); mysrand(cycle + 1); for (i = 0; i < MAX_ITEMS; ) { for (j = 0; j < esize; i++, j++) { elem[j] = (cycle == 0) ? i : (myrand() + 1); } elem = spm_bte_produce(&bte); } spm_bte_finish(&bte); invalidate_data_cache(); printf("%u checking test pattern, element size %u/n", cycle, esize); mysrand(cycle + 1); x = 0; for (i = 0; i < MAX_ITEMS; i++) { j = (cycle == 0) ? i : (myrand() + 1); if (off_chip[i] != j) { printf("off_chip[%08x] = %08x should be %08x/n", i, off_chip[i], j); x++; assert(x < 10); } } assert(!x); x = 0; for (i = 0; i < (DATA_SPM_WORDS * 2); i++) { if (off_chip[i + MAX_ITEMS] != (check | i)) { x = i; } } printf("producer overshot by %u (%u)/n", x, DATA_SPM_WORDS * 2); printf("%u single buffer tests/n", cycle); mysrand(cycle + 0x2000); for (i = 0; (i < (3 + cycle)) && (i < 25); i++) { unsigned elem_size = 4 << (myrand() % 4); unsigned spm_elems = DATA_SPM_SIZE / elem_size; unsigned total_elems; spm_elems /= 1 << (myrand() % 4); if (spm_elems < 2) { spm_elems = 2; } total_elems = (myrand() % MAX_ITEMS) + 1; tester((myrand() % total_elems) % 256, total_elems, elem_size, spm_elems * elem_size); } mysrand(cycle + 0x1000); printf("%u multi-buffer tests, myrand %04x/n", cycle, myrand() & 0xffff); multibuf(myrand(), 2 + (myrand() % 15), run_limit); for (i = 2; i <= 16; i++) { multibuf(1024, i, run_limit); }//.........这里部分代码省略.........
开发者ID:alexjordan,项目名称:patmos-misc,代码行数:101,
示例6: gkLoaderUtils_getLayers_legacy//.........这里部分代码省略......... { if (mtface[i] != 0) { f.uvLayers[i][0] = gkVector2((float*)mtface[i][fi].uv[0]); f.uvLayers[i][1] = gkVector2((float*)mtface[i][fi].uv[1]); f.uvLayers[i][2] = gkVector2((float*)mtface[i][fi].uv[2]); } } vpak[0] = mvert[curface.v1]; vpak[1] = mvert[curface.v2]; vpak[2] = mvert[curface.v3]; ipak[0] = curface.v1; ipak[1] = curface.v2; ipak[2] = curface.v3; if (mcol != 0) { cpak[0] = packColourABGR(mcol[0]); cpak[1] = packColourABGR(mcol[1]); cpak[2] = packColourABGR(mcol[2]); } else cpak[0] = cpak[1] = cpak[2] = cpak[3] = 0xFFFFFFFF; f.verts = vpak; f.index = ipak; f.colors = cpak; convertIndexedTriangle(&t[0], 0, 1, 2, f); } gkMeshPair tester(curSubMesh); if (sortByMat) { int mode = 0; if (mtface[0]) mode = mtface[0][fi].mode; tester.test = gkMeshHashKey(curface.mat_nr, mode); } else { Blender::Image* ima[8] = {0, 0, 0, 0, 0, 0, 0, 0}; for (int i = 0; i < totlayer; i++) { if (mtface[i] != 0) ima[i] = mtface[i][fi].tpage; } int mode = 0, alpha = 0; if (mtface[0]) { mode = mtface[0][fi].mode; alpha = mtface[0][fi].transp; } tester.test = gkMeshHashKey(mode, alpha, ima); } // find submesh UTsize arpos = 0; if ((arpos = m_meshtable.find(tester)) == UT_NPOS) { curSubMesh = new gkSubMesh();
开发者ID:Ali-il,项目名称:gamekit,代码行数:67,
示例7: mp4_createSeekedint mp4_createSeeked(const char *path, float fStart) { int rc = 0; MP4_CONTAINER_T *pMp4; BOX_T *pBoxTrak; BOX_T *pBox; BOX_HDLR_T *pBoxHdlr; MP4_TRAK_T mp4TrakTmp; MP4_TRAK_T mp4TrakAud; MP4_TRAK_T mp4TrakVid; MP4_TRAK_T *pMp4TrakVid = NULL; MP4_TRAK_T *pMp4TrakAud = NULL; MP4_STBL_CLONE_T cloneVid; MP4_STBL_CLONE_T cloneAud; uint64_t startHz = 0; if(!(pMp4 = mp4_open(path, 1))) { return -1; } memset(&cloneVid, 0, sizeof(cloneVid)); memset(&cloneAud, 0, sizeof(cloneAud)); if(!(pBoxTrak = mp4_findBoxInTree(pMp4->proot, *((uint32_t *) "moov"))) || !(pBoxTrak = pBoxTrak->child)) { LOG(X_ERROR("No tracks found in mp4")); mp4_close(pMp4); return -1; } while(pBoxTrak && (!pMp4TrakAud || !pMp4TrakVid)) { if(pBoxTrak->type != *((uint32_t *) "trak") || !(pBoxHdlr = (BOX_HDLR_T *) mp4_findBoxInTree(pBoxTrak, *((uint32_t *) "hdlr")))) { pBoxTrak = pBoxTrak->pnext; continue; } memset(&mp4TrakTmp, 0, sizeof(MP4_TRAK_T)); mp4TrakTmp.pTrak = pBoxTrak; pBox = fillTrack(&mp4TrakTmp, 0); if(!pBox) { pBoxTrak = pBoxTrak->pnext; continue; } if(!pMp4TrakAud && (pBoxHdlr->handlertype == *((uint32_t *) "soun") || pBoxHdlr->handlertype == *((uint32_t *) "sdsm"))) { memcpy(&mp4TrakAud, &mp4TrakTmp, sizeof(mp4TrakAud)); pMp4TrakAud = &mp4TrakAud; } else if(!pMp4TrakVid && pBoxHdlr->handlertype == *((uint32_t *) "vide")) { memcpy(&mp4TrakVid, &mp4TrakTmp, sizeof(mp4TrakVid)); pMp4TrakVid = &mp4TrakVid; } pBoxTrak = pBoxTrak->pnext; }fStart=15; if(pMp4TrakVid) { startHz = (uint64_t) (fStart * pMp4TrakVid->pMdhd->timescale); fprintf(stdout, "vid seek %lldHz/n", startHz); cloneVid.useSyncSample = 1; tester(pMp4TrakVid, pMp4->pStream, startHz, &cloneVid); } /* if(pMp4TrakAud) { startHz = (uint64_t) (fStart * pMp4TrakAud->pMdhd->timescale); fprintf(stdout, "aud seek %lldHz/n", startHz); tester(pMp4TrakAud, pMp4->pStream, startHz, &cloneAud); }*/ mp4_close(pMp4); return rc;}
开发者ID:amirsdream,项目名称:openvcx,代码行数:86,
示例8: mainint main(void) { tester(7); getchar();}
开发者ID:KManiKumarReddy,项目名称:extra_problems,代码行数:4,
示例9: test_fp_manipulation bool test_fp_manipulation(std::ostream& out, const std::string& name) { simd_fpmanip_tester<T, N, A> tester(name); return test_simd_fp_manipulation(out, tester); }
开发者ID:jmabille,项目名称:nxsimd,代码行数:5,
示例10: testConstantScoreRangeQueryvoid testConstantScoreRangeQuery( CuTest * pTc ){ /// Run Java Lucene tests TestConstantScoreRangeQuery tester( pTc ); tester.runTests();}
开发者ID:AlanForeverAi,项目名称:WizQTClient,代码行数:6,
示例11: testervoid Cqtpainter::Test(){ CQtTester tester(m_painter, g_nNumbers, g_bRandom); tester.Test();}
开发者ID:okenjian,项目名称:coding,代码行数:5,
示例12: objendFUNCTION objend (){ register Ocb * o; extern int aggressive; Debug o = xqting_ocb; destroy_message_vector (o); if ( o->centry == DCRT || o->centry == DDES ) { unmark_macro ( o->ci ); } else { register Msgh * n; for ( n = fstigb ( o->ci ); n; n = nxtigb ( n ) ) { if ( n->mtype != DYNDSMSG ) unmark_macro ( n ); } } if ( o->centry == INIT || o->centry == DCRT || o->centry == DDES ) {#ifdef SOM /* Update the phase's highest-seen ept field to the Ept of the event just completed. Also update the amount of total unrolled back work done by the phase. */ o->Ept = o->sb->Ept;#endif SOM save_state (o); } if ( o->centry == EVENT ) { o->stats.numecomp++; o->eventTimePermitted -= o->sb->effectWork;#ifdef SOM /* Update the phase's highest-seen ept field to the Ept of the event just completed. Also update the amount of total unrolled back work done by the phase. */ o->Ept = o->sb->Ept;#endif SOM save_state ( o ); } else if ( o->centry == TERM ) {#ifdef RBC if ( o->uses_rbc ) l_destroy ( o->sb ); else /* destroy_state and rollback chip don't mix */#endif destroy_state ( o->sb ); o->sb = NULL; l_destroy ( o->stk ); o->stk = NULL;#ifdef RBC if ( o->uses_rbc && rollback_op ( o, 1, posinfPlus1 ) ) { printf ( "weird error term objend for %s/n", o->name ); tester(); }#endif o->ci = NULL; o->co = NULL; o->control = EDGE; o->runstat = BLKINF; if ( ! aggressive ) cancel_omsgs ( o, o->svt, o->phase_end ); l_remove ( o ); o->svt = posinfPlus1; l_insert ( l_prev_macro ( _prqhd ), o ); dispatch (); return; } go_forward ( o ) ; dispatch ();}
开发者ID:ivan-gimenez,项目名称:timewarp,代码行数:96,
示例13: Msgvoid CPredictionCopyTester::RunTests( void ){ CCopyTesterData2 *foo1, *foo2, *foo3; foo1 = new CCopyTesterData2; foo2 = new CCopyTesterData2; foo3 = new CCopyTesterData2; foo2->MakeDifferent(); CPredictionCopy::PrepareDataMap( foo1->GetPredDescMap() ); CPredictionCopy::PrepareDataMap( foo2->GetPredDescMap() ); CPredictionCopy::PrepareDataMap( foo2->GetPredDescMap() ); // foo1 == foo3 // foo1 != foo2 { Msg( "Comparing and copying == objects, should have zero diffcount/n" ); // Compare foo1 and foo3, should be equal CPredictionCopy tester( PC_NON_NETWORKED_ONLY, foo1, false, foo3, false, CPredictionCopy::TRANSFERDATA_ERRORCHECK_SPEW ); int diff_count = 0; diff_count = tester.TransferData( "test1", -1, foo3->GetPredDescMap() ); Msg( "diff_count == %i/n", diff_count ); Assert( !diff_count ); } { Msg( "Simple compare of != objects, should spew and have non-zero diffcount/n" ); // Compare foo1 and foo2, should differ CPredictionCopy tester( PC_NON_NETWORKED_ONLY, foo1, false, foo2, false, CPredictionCopy::TRANSFERDATA_ERRORCHECK_SPEW ); int diff_count = 0; diff_count = tester.TransferData( "test2", -1, foo2->GetPredDescMap() ); Msg( "diff_count == %i (should be 13)/n", diff_count ); Assert( diff_count == 13 ); } { Msg( "Comparing and copying same objects, should spew and have non-zero diffcount/n" ); // Compare foo1 and foo2 while overriting foo2, should have differences but leave objects == CPredictionCopy tester( PC_NON_NETWORKED_ONLY, foo1, false, foo2, false, CPredictionCopy::TRANSFERDATA_COPYONLY ); tester.TransferData( "test2", -1, foo1->GetPredDescMap() ); } { Msg( "Comparing and copying objects which were just made to coincide, should have zero diffcount/n" ); // Make sure foo1 is now == foo2 CPredictionCopy tester( PC_NON_NETWORKED_ONLY, foo1, false, foo2, false, CPredictionCopy::TRANSFERDATA_ERRORCHECK_SPEW ); int diff_count = 0; diff_count = tester.TransferData( "test4", -1, foo2->GetPredDescMap() ); Msg( "diff_count == %i/n", diff_count ); Assert( !diff_count ); } delete foo3; delete foo2; delete foo1;}
开发者ID:Cre3per,项目名称:hl2sdk-csgo,代码行数:65,
示例14: run void run() { IncTester tester( 0 /* inc without wait */ ); tester.go(); ASSERT( tester.wait() ); ASSERT_EQUALS( tester.getVal() , 1 ); }
开发者ID:ALFIO,项目名称:mongo,代码行数:6,
示例15: mainint main(int argc, char *argv[]){ // Initialize MPI#ifdef HAVE_MPI MPI_Init(&argc,&argv);#endif // Create a communicator for Epetra objects#ifdef HAVE_MPI Epetra_MpiComm Comm( MPI_COMM_WORLD );#else Epetra_SerialComm Comm;#endif int * testInt = new int[100]; delete [] testInt; bool verbose = false; if (argc > 1) if (argv[1][0]=='-' && argv[1][1]=='v') verbose = true; // Get the process ID and the total number of processors int MyPID = Comm.MyPID(); int NumProc = Comm.NumProc(); // Set up theolver options parameter list Teuchos::RCP<Teuchos::ParameterList> noxParamsPtr = Teuchos::rcp(new Teuchos::ParameterList); Teuchos::ParameterList & noxParams = *(noxParamsPtr.get()); // Set up the printing utilities // Only print output if the "-v" flag is set on the command line Teuchos::ParameterList& printParams = noxParams.sublist("Printing"); printParams.set("MyPID", MyPID); printParams.set("Output Precision", 5); printParams.set("Output Processor", 0); if( verbose ) printParams.set("Output Information", NOX::Utils::OuterIteration + NOX::Utils::OuterIterationStatusTest + NOX::Utils::InnerIteration + NOX::Utils::Parameters + NOX::Utils::Details + NOX::Utils::Warning + NOX::Utils::TestDetails); else printParams.set("Output Information", NOX::Utils::Error + NOX::Utils::TestDetails); Teuchos::RCP<NOX::Utils> printing = Teuchos::rcp( new NOX::Utils(printParams) ); // Identify the test problem if (printing->isPrintType(NOX::Utils::TestDetails)) printing->out() << "Starting epetra/NOX_Operators/NOX_BroydenOp.exe" << std::endl; // Identify processor information#ifdef HAVE_MPI if (printing->isPrintType(NOX::Utils::TestDetails)) { printing->out() << "Parallel Run" << std::endl; printing->out() << "Number of processors = " << NumProc << std::endl; printing->out() << "Print Process = " << MyPID << std::endl; } Comm.Barrier(); if (printing->isPrintType(NOX::Utils::TestDetails)) printing->out() << "Process " << MyPID << " is alive!" << std::endl; Comm.Barrier();#else if (printing->isPrintType(NOX::Utils::TestDetails)) printing->out() << "Serial Run" << std::endl;#endif int status = 0; // Create a TestCompare class NOX::Epetra::TestCompare tester( printing->out(), *printing); double abstol = 1.e-4; double reltol = 1.e-4 ; // Test NOX::Epetra::BroydenOperator int numGlobalElems = 3 * NumProc; Epetra_Map broydenRowMap ( numGlobalElems, 0, Comm ); Epetra_Vector broydenWorkVec ( broydenRowMap ); Epetra_CrsGraph broydenWorkGraph( Copy, broydenRowMap, 0 ); std::vector<int> globalIndices(3); for( int lcol = 0; lcol < 3; ++lcol ) globalIndices[lcol] = 3 * MyPID + lcol; std::vector<int> myGlobalIndices(2); // Row 1 structure myGlobalIndices[0] = globalIndices[0]; myGlobalIndices[1] = globalIndices[2]; broydenWorkGraph.InsertGlobalIndices( globalIndices[0], 2, &myGlobalIndices[0] ); // Row 2 structure myGlobalIndices[0] = globalIndices[0]; myGlobalIndices[1] = globalIndices[1]; broydenWorkGraph.InsertGlobalIndices( globalIndices[1], 2, &myGlobalIndices[0] ); // Row 3 structure//.........这里部分代码省略.........
开发者ID:jgoldfar,项目名称:trilinos,代码行数:101,
示例16: mainint main(int argc, char *argv[]) { // Initialize POOMA and output stream, using Tester class Pooma::initialize(argc, argv); Pooma::Tester tester(argc, argv); Interval<1> a(0,10),b(0,20),r(3,7); Interval<2> s(a,b),rr(r,r); typedef std::vector<Interval<2> > DomainList_t; DomainList_t res; tester.out() << " from " << s<< " remove "<<rr<<std::endl; res = DomainRemoveOverlap(s,rr); DomainList_t::iterator start = res.begin(); DomainList_t::iterator end = res.end(); for ( ; start!=end ; ++start) { tester.out() << *start << std::endl; } res.clear(); Interval<2> k(Interval<1>(2,3),Interval<1>(-1,30)); res = DomainRemoveOverlap(s,k); start = res.begin(); end = res.end(); for ( ; start!=end ; ++start) { tester.out() << *start << std::endl; } res.clear(); Interval<2> k2(Interval<1>(2,3),Interval<1>(0,20)); res = DomainRemoveOverlap(s,k2); tester.out() << " " <<std::endl; tester.out() <<"from " <<s<<" remove "<<k2<<std::endl; tester.out() << " " <<std::endl; start = res.begin(); end = res.end(); for ( ; start!=end ; ++start) { tester.out() << *start << std::endl; } res.clear(); Interval<2> k3(Interval<1>(-7,3),Interval<1>(-6,8)); res = DomainRemoveOverlap(s,k3); tester.out() << " " <<std::endl; tester.out() <<"from "<< s<<" remove "<<k3<<std::endl; tester.out() << " " <<std::endl; start = res.begin(); end = res.end(); for ( ; start!=end ; ++start) { tester.out() << *start << std::endl; } tester.out() << "-------------------------------------------" << std::endl; int retval = tester.results("DomainRO operations"); Pooma::finalize(); return retval;}
开发者ID:pathscale,项目名称:freepooma-testsuite,代码行数:76,
示例17: mainint main(int argc, char *argv[]){ Pooma::initialize(argc,argv); Pooma::Tester tester(argc, argv); // -------------------------------------------------------------------------- // 3D // -------------------------------------------------------------------------- Tensor<3,double,Full> t3f1(0.0, 3.0, 6.0, 1.0, 4.0, 7.0, 2.0, 5.0, 8.0); tester.out() << "t3f1: " << t3f1 << std::endl; Tensor<3,double,Full> t3f2 = -t3f1; tester.out() << "t3f2: " << t3f2 << std::endl; Tensor<3,double,Symmetric> t3s1(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); tester.out() << "t3s1: " << t3s1 << std::endl; Tensor<3,double,Symmetric> t3s2(-1.0, -2.0, -3.0, -4.0, -5.0, -6.0); tester.out() << "t3s2: " << t3s2 << std::endl; Tensor<3,double,Full> t3s1AsFull(1.0,2.0,4.0, 2.0,3.0,5.0, 4.0,5.0,6.0); tester.out() << "t3s1AsFull: " << t3s1AsFull << std::endl; Tensor<3,double,Full> t3s2AsFull = -t3s1AsFull; tester.out() << "t3s2AsFull: " << t3s2AsFull << std::endl; Tensor<3,double,Symmetric> t3s3(9.0, 9.0, 9.0, 9.0, 9.0, 9.0), t3s4(9.0, 9.0, 9.0, 9.0, 9.0, 9.0); t3s3 = t3s1 + t3s2; tester.out() << "t3s3 = t3s1 + t3s2: " << t3s3 << std::endl; tester.check("t3s3", t3s3, Tensor<3,double,Symmetric>(0.0)); tester.check("t3s3 against Full", (t3s3 == Tensor<3,double,Symmetric>(0.0))); Tensor<3,double,Full> t3f3(99.9), t3f4(99.9), t3f5(99.9), t3f6(99.9); t3f3 = t3f1 + t3f2; // No need to check results here; done in TestTensors t3f4 = t3s1 + t3s2; tester.out() << "t3f4 = t3s1 + t3s2: " << t3f4 << std::endl; tester.check("t3f4", (t3f4 == t3s3)); t3f5 = t3f1 + t3s2; tester.out() << "t3f5 = t3f1 + t3s2: " << t3f5 << std::endl; tester.check("t3f5", t3f5, t3f1 + t3s2AsFull); t3f6 = t3s2 + t3f1; tester.out() << "t3f6 = t3s2 + t3f1: " << t3f6 << std::endl; tester.check("t3f6", t3f6, t3f1 + t3s2AsFull); t3f6 -= t3f1; tester.out() << "t3f6 -= t3f1: " << t3f6 << std::endl; tester.check("t3f6", t3f6, t3s2AsFull); t3s4 = t3s3 - t3f1; tester.out() << "t3s4 = t3s3 - t3f1: " << t3s4 << std::endl; tester.check("t3s4", (t3s4 == Tensor<3,double,Symmetric>(0,-3,-4,-6,-7,-8))); // Test Tensor dot Tensor: // Full: double sum = 0.0; int i, j, k; t3f3 = dot(t3f1, t3f2); for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { for (k = 0; k < 3; ++k) { t3f3(i,k) -= t3f1(i,j)*t3f2(j,k); } } } t3f3 = t3f3*t3f3; for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { sum += t3f3(i,j); } } tester.check("dot(t3f1, t3f2)", (sum == 0)); // Symmetric: sum = 0.0; t3f3 = dot(t3s1, t3s2); for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { for (k = 0; k < 3; ++k) { t3f3(i,k) -= t3s1(i,j)*t3s2(j,k); } } } t3f3 = t3f3*t3f3; for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { sum += t3f3(i,j); } } tester.check("dot(t3s1, t3s2)", (sum == 0)); // Test Tensor dot Vector, and vice-versa: // Full://.........这里部分代码省略.........
开发者ID:pathscale,项目名称:freepooma-testsuite,代码行数:101,
示例18: gkLoaderUtils_getLayers_bmesh//.........这里部分代码省略......... if (mtpoly[i] != 0) { f.uvLayers[i][0] = gkVector2((float*)&muvs[i][curpoly.loopstart].uv[0]); f.uvLayers[i][1] = gkVector2((float*)&muvs[i][curpoly.loopstart+1].uv[0]); f.uvLayers[i][2] = gkVector2((float*)&muvs[i][curpoly.loopstart+2].uv[0]); } } vpak[0] = mvert[v1.v]; vpak[1] = mvert[v2.v]; vpak[2] = mvert[v3.v]; ipak[0] = v1.v; ipak[1] = v2.v; ipak[2] = v3.v; if (mloopCol != 0) { cpak[0] = *(unsigned int*)(mloopCol + curpoly.loopstart); cpak[1] = *(unsigned int*)(mloopCol + curpoly.loopstart+1); cpak[2] = *(unsigned int*)(mloopCol + curpoly.loopstart+2); } else cpak[0] = cpak[1] = cpak[2] = 0xFFFFFFFF; f.verts = vpak; f.index = ipak; f.colors = cpak; convertIndexedTriangle(&t[0], 0, 1, 2, f); } gkMeshPair tester(curSubMesh); if (sortByMat) { int mode = 0; if (mtpoly[0]) mode = mtpoly[0][fi].mode; tester.test = gkMeshHashKey(curpoly.mat_nr, mode); } else { Blender::Image* ima[8] = {0, 0, 0, 0, 0, 0, 0, 0}; for (int i = 0; i < totlayer; i++) { if (mtpoly[i] != 0) ima[i] = mtpoly[i][fi].tpage; } int mode = 0, alpha = 0; if (mtpoly[0]) { mode = mtpoly[0][fi].mode; alpha = mtpoly[0][fi].transp; } tester.test = gkMeshHashKey(mode, alpha, ima); } // find submesh
开发者ID:Ali-il,项目名称:gamekit,代码行数:67,
示例19: test_simd_int bool test_simd_int(std::ostream& out, const std::string& name) { simd_int_basic_tester<T, N, A> tester(name); return test_simd_int_basic(out, tester); }
开发者ID:jmabille,项目名称:nxsimd,代码行数:5,
示例20: mainint main(int argc, char *argv[]){ Pooma::initialize(argc, argv); Pooma::Tester tester(argc, argv);#if POOMA_CHEETAH typedef Cheetah::MatchingHandler Handler_t; const int numContexts = Pooma::contexts(); const int myContext = Pooma::context(); Handler_t *handler = new Cheetah::MatchingHandler(*Pooma::controller()); tester.out() << "Testing Grid messages . . ./n"; tester.out() << "Running with " << numContexts << " contexts." << std::endl; int start = myContext * 10; int end = (myContext + 1) * 10; Range<1> r(start, end, 2); Grid<1> foo(r); tester.out() << "Here are our Grids..." << std::endl; BARRIER; tester.out().setOutputContext(-1); tester.out() << foo << std::endl; // Here's the message pattern - we're just sending in a ring: int toContext = (myContext + 1) % numContexts; int fromContext = (myContext + numContexts - 1) % numContexts; BARRIER; tester.out() << "Node " << myContext << "; Sending to " << toContext << "; Receiving from " << fromContext << std::endl; int msgtag = 0; handler->send(toContext, msgtag, foo); Send_t bar; handler->request(fromContext, msgtag, receiveGrid, &bar); while (!gotIt) Pooma::poll(); BARRIER; tester.out().setOutputContext(0); tester.out() << "Here are the Grids we received:" << std::endl; BARRIER; tester.out().setOutputContext(-1); tester.out() << bar << std::endl; start = fromContext * 10; end = (fromContext + 1) * 10; Range<1> ans(start, end, 2); BARRIER; tester.check(bar == ans); delete handler;#else tester.out() << "This test requires Cheetah" << std::endl;#endif int ret = tester.results("GridMessage Test"); Pooma::finalize(); return ret;}
开发者ID:pathscale,项目名称:freepooma-testsuite,代码行数:84,
示例21: test_simd_cast bool test_simd_cast(std::ostream& out, const std::string& name) { simd_cast_tester<N, A> tester(name); return test_simd_cast(out, tester); }
开发者ID:jmabille,项目名称:nxsimd,代码行数:5,
示例22: test_exponential bool test_exponential(std::ostream& out, const std::string& name) { simd_exponential_tester<T, N, A> tester(name); return test_simd_exponential(out, tester); }
开发者ID:jmabille,项目名称:nxsimd,代码行数:5,
示例23: test_complex_simd_load_store bool test_complex_simd_load_store(std::ostream& out, const std::string& name) { simd_complex_ls_tester<T, N, A> tester(name); return test_complex_simd_load_store(out, tester); }
开发者ID:jmabille,项目名称:nxsimd,代码行数:5,
示例24: activatedvoid tst_QSocketNotifier::unexpectedDisconnection(){ /* Given two sockets and two QSocketNotifiers registered on each their socket. If both sockets receive data, and the first slot invoked by one of the socket notifiers empties both sockets, the other notifier will also emit activated(). This results in unexpected disconnection in QAbstractSocket. The use case is that somebody calls one of the waitFor... functions in a QSocketNotifier activated slot, and the waitFor... functions do local selects that can empty both stdin and stderr while waiting for fex bytes to be written. */ QTcpServer server; QVERIFY(server.listen(QHostAddress::LocalHost, 0)); NATIVESOCKETENGINE readEnd1; readEnd1.initialize(QAbstractSocket::TcpSocket); readEnd1.connectToHost(server.serverAddress(), server.serverPort()); QVERIFY(readEnd1.waitForWrite()); QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); QVERIFY(server.waitForNewConnection()); QTcpSocket *writeEnd1 = server.nextPendingConnection(); QVERIFY(writeEnd1 != 0); NATIVESOCKETENGINE readEnd2; readEnd2.initialize(QAbstractSocket::TcpSocket); readEnd2.connectToHost(server.serverAddress(), server.serverPort()); QVERIFY(readEnd2.waitForWrite()); QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState); QVERIFY(server.waitForNewConnection()); QTcpSocket *writeEnd2 = server.nextPendingConnection(); QVERIFY(writeEnd2 != 0); writeEnd1->write("1", 1); writeEnd2->write("2", 1); writeEnd1->waitForBytesWritten(); writeEnd2->waitForBytesWritten(); writeEnd1->flush(); writeEnd2->flush(); UnexpectedDisconnectTester tester(&readEnd1, &readEnd2); QTimer timer; timer.setSingleShot(true); timer.start(30000); do { // we have to wait until sequence value changes // as any event can make us jump out processing QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); QVERIFY(timer.isActive()); //escape if test would hang } while(tester.sequence <= 0); QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); QVERIFY(readEnd2.state() == QAbstractSocket::ConnectedState); QCOMPARE(tester.sequence, 2); readEnd1.close(); readEnd2.close(); writeEnd1->close(); writeEnd2->close(); server.close();}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:68,
示例25: Mainvoid Main(int argc, char** argv){ std::vector<Patterns> patterns; std::vector<std::string> types; std::string file; std::string algName = "run"; int repCount = 10; ITester::Algorithm alg; for (--argc, ++argv; argc; --argc, ++argv) { if (!strcmp(*argv, "-t") && argc >= 2) { types.push_back(argv[1]); patterns.push_back(Patterns()); --argc, ++argv; } else if (!strcmp(*argv, "-f") && argc >= 2) { file = argv[1]; --argc, ++argv; } else if (!strcmp(*argv, "-a") && argc >= 2) { algName = argv[1]; --argc, ++argv; } else if (!strcmp(*argv, "-c") && argc >= 2) { repCount = Pire::FromString<int>(argv[1]); --argc, ++argv; } else if (!strcmp(*argv, "-e") && argc >= 2) { if (patterns.empty()) throw usage; patterns.back().push_back(argv[1]); --argc, ++argv; } else { if (patterns.empty()) throw usage; patterns.back().push_back(*argv); } } if (types.empty() || file.empty() || patterns.back().empty()) throw usage; if (algName == "run") alg = ITester::DefaultRun; else if (algName == "shortestprefix") alg = ITester::ShortestPrefix; else if (algName == "longestprefix") alg = ITester::LongestPrefix; else throw usage; std::unique_ptr<ITester> tester(CreateTester(types)); tester->Prepare(alg, patterns); FileMmap fmap(file.c_str()); // Run the benchmark multiple times std::ostringstream stream; for (std::vector<std::string>::iterator j = types.begin(), je = types.end(); j != je; ++j) stream << *j << " "; std::string typesName = stream.str(); for (int i = 0; i < repCount; ++i) { Timer timer(typesName, fmap.Size()); tester->Run(fmap.Begin(), fmap.End()); }}
开发者ID:yandex,项目名称:pire,代码行数:61,
示例26: mainint main(int argc, char* argv[]){ // initialize Pooma Pooma::initialize(argc,argv); Pooma::Tester tester(argc,argv); int return_status = 0; int n = 20; double pi = 3.1415926535897932; Array<1> a(n),b(n),c(n),d(n); Array<1,double,CompressibleBrick> aa(n),bb(n),cc(n),dd(n); int i; for (i=0; i<n; ++i) { a(i) = sin(0.1*pi*i); b(i) = cos(0.1*pi*i); c(i) = 1.0; d(i) = 2.0; } tester.out() << "Testing Compressile Bricks." << std::endl; aa = a; bb = b; cc = c; dd = d; Pooma::blockAndEvaluate(); tester.out() << " i aa bb cc dd " << std::endl; for (i=0; i<n; ++i) { tester.out() << i << " " << aa.read(i) << " " << bb.read(i) << " " << cc.read(i) << " " << dd.read(i) << std::endl; } tester.out() << "aa: " << compressed(aa) << std::endl; tester.out() << "bb: " << compressed(bb) << std::endl; tester.out() << "cc: " << compressed(cc) << std::endl; tester.out() << "dd: " << compressed(dd) << std::endl; tester.check(!aa.engine().compressed()); tester.check(!bb.engine().compressed()); tester.check(cc.engine().compressed()); tester.check(dd.engine().compressed()); aa = aa*aa+bb*bb; bb = cc*dd+2.0*cc; bb += cc*dd+2.0*cc; cc = dd*c+d; Pooma::blockAndEvaluate(); tester.out() << " i aa bb cc dd " << std::endl; for (i=0; i<n; ++i) { tester.out() << i << " " << aa.read(i) << " " << bb.read(i) << " " << cc.read(i) << " " << dd.read(i) << std::endl; } tester.out() << "aa: " << compressed(aa) << std::endl; tester.out() << "bb: " << compressed(bb) << std::endl; tester.out() << "cc: " << compressed(cc) << std::endl; tester.out() << "dd: " << compressed(dd) << std::endl; tester.check(!aa.engine().compressed()); tester.check(bb.engine().compressed()); tester.check(cc.engine().compressed()); tester.check(dd.engine().compressed()); a = b+dd*cc; Pooma::blockAndEvaluate(); tester.out() << "a: "; for (i=0; i<n; ++i) { tester.out() << "(" << i << ")=" << a.read(i) << ","; } tester.out() << std::endl; tester.out() << "------------------------------------------------" << std::endl; int retval = tester.results("compressibleTest1"); Pooma::finalize(); return return_status;}
开发者ID:pathscale,项目名称:freepooma-testsuite,代码行数:89,
示例27: mainint main(int argc, char *argv[]) { Pooma::initialize(argc, argv); Pooma::Tester tester(argc, argv); Interval<1> n1(1,5); Interval<1> n2(4,8); Interval<1> n3(10,20); Interval<2> a(n1,n2); Interval<3> b(n1,n2,n3); Range<1> r1(1,5); Range<1> r2(4,8,2); Range<1> r3(5,9,2); Range<1> r4(10,20,5); Range<2> ra(r1,r2); Range<2> rb(r1,r3); Range<3> rc(r1,r2,r3); tester.out() << "1: touches(" << a[0] << "," << a[1] << ") ? "; tester.out() << touches(a[0], a[1]) << std::endl; tester.check( touches(a[0], a[1]) ); tester.out() << "0: touches(" << a[0] << "," << b[2] << ") ? "; tester.out() << touches(a[0], b[2]) << std::endl; tester.check( touches(a[0], b[2])==0); tester.out() << "1: touches(" << a[0] << "," << ra[0] << ") ? "; tester.out() << touches(a[0], ra[0]) << std::endl; tester.check(touches(a[0], ra[0])); tester.out() << "1: touches(" << ra[0] << "," << ra[1] << ") ? "; tester.out() << touches(ra[0], ra[1]) << std::endl; tester.check( touches(ra[0], ra[1])); tester.out() << "0: touches(" << r2 << "," << r3 << ") ? "; tester.out() << touches(r2, r3) << std::endl; tester.check( touches(r2, r3)==0); tester.out() << "0: touches(" << ra << "," << rb << ") ? "; tester.out() << touches(ra, rb) << std::endl; tester.check( touches(ra, rb) ==0); tester.out() << "1: touches(" << rc << "," << rc << ") ? "; tester.out() << touches(rc, rc) << std::endl; tester.check( touches(rc, rc) ); tester.out() << "------------------------------------" << std::endl; tester.check(" touches ", true); Interval<1> c1(1,10); Interval<1> c2(3,8); Interval<1> c3(5,15); Interval<2> ca(c1, c1); Interval<2> cb(c1, c2); Range<1> cr1(2,20,2); Range<1> cr2(4,16,4); Range<1> cr3(3,15,2); Range<1> cr4(5,15,5); tester.out() << "1: contains(" << c1 << "," << c2 << ") ? "; tester.out() << contains(c1,c2) << std::endl; tester.check(contains(c1,c2)); tester.out() << "0: contains(" << c2 << "," << c1 << ") ? "; tester.out() << contains(c2,c1) << std::endl; tester.check(contains(c2,c1)==0); tester.out() << "0: contains(" << c1 << "," << c3 << ") ? "; tester.out() << contains(c1,c3) << std::endl; tester.check(contains(c1,c3)==0); tester.out() << "1: contains(" << ca << "," << cb << ") ? "; tester.out() << contains(ca,cb) << std::endl; tester.check(contains(ca,cb)); tester.out() << "0: contains(" << cb << "," << ca << ") ? "; tester.out() << contains(cb,ca) << std::endl; tester.check(contains(cb,ca)==0); tester.out() << "1: contains(" << cr1 << "," << cr2 << ") ? "; tester.out() << contains(cr1,cr2) << std::endl; tester.check( contains(cr1,cr2)); tester.out() << "0: contains(" << cr1 << "," << cr3 << ") ? "; tester.out() << contains(cr1,cr3) << std::endl; tester.check(contains(cr1,cr3)==0); tester.out() << "1: contains(" << c3 << "," << cr4 << ") ? "; tester.out() << contains(c3,cr4) << std::endl; tester.check(contains(c3,cr4)); tester.out() << "0: contains(" << cr4 << "," << c3 << ") ? "; tester.out() << contains(cr4,c3) << std::endl; tester.check(contains(cr4,c3)==0); tester.out() << "------------------------------------" << std::endl; Interval<2> s1, s2; Range<2> sr1, sr2; split(cb, s1, s2); tester.out() << "split(" << cb << ") = " << s1 << " and " << s2 << std::endl; tester.check(s1==Interval<2>(Interval<1>(1,5),Interval<1>(3,5))); tester.check(s2==Interval<2>(Interval<1>(6,10),Interval<1>(6,8))); split(rb, sr1, sr2); tester.out() << "split(" << rb << ") = " << sr1 << " and " << sr2 << std::endl; tester.check(sr1==Range<2>(Range<1>(1,2),Range<1>(5,5,2))); tester.check(sr2==Range<2>(Range<1>(3,5),Range<1>(7,9,2))); tester.out() << "------------------------------------" << std::endl;//.........这里部分代码省略.........
开发者ID:pathscale,项目名称:freepooma-testsuite,代码行数:101,
注:本文中的tester函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tester_get_data函数代码示例 C++ testcase函数代码示例 |