这篇教程C++ test函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中test函数的典型用法代码示例。如果您正苦于以下问题:C++ test函数的具体用法?C++ test怎么用?C++ test使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了test函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: compute_distance_point_triangle//.........这里部分代码省略......... this->computeGridCoordinates(cMin, cMax, v1, v2, v3); //std::cout << "cMin[0] = " << cMin[0] << std::endl; //std::cout << "cMin[1] = " << cMin[1] << std::endl; //std::cout << "cMin[2] = " << cMin[2] << std::endl; //std::cout << "cMax[0] = " << cMax[0] << std::endl; //std::cout << "cMax[1] = " << cMax[1] << std::endl; //std::cout << "cMax[2] = " << cMax[2] << std::endl; // for each coordinate within the bounding box for (unsigned int k = cMin[2]; k <= cMax[2]; k++) { for (unsigned int j = cMin[1]; j <= cMax[1]; j++) { for (unsigned int i = cMin[0]; i <= cMax[0]; i++) { // translate coordinate to world coordinates x[0] = x0 + i*mDx; x[1] = y0 + j*mDx; x[2] = z0 + k*mDx; // compute distance to the triangle compute_distance_point_triangle(dist, normal, x, v1, v2, v3); // update sparse voxel map if (dist <= mMaxDist) { Coordinate coord(i, j, k); // if the map already contains distance information // at the current coordinate if (map.contains(coord)) { // check if the previously computed distance is // is greater than [dist]. float prev; float* nodeContent; map.get(nodeContent, coord); prev = nodeContent[NC_DISTANCE]; if (prev > dist) { // if yes, update the map delete[] nodeContent; nodeContent = new float[NC_NUM_ELEMENTS]; nodeContent[NC_DISTANCE] = dist; nodeContent[NC_NORMAL_X] = normal[0]; nodeContent[NC_NORMAL_Y] = normal[1]; nodeContent[NC_NORMAL_Z] = normal[2]; map.add(coord, nodeContent); } } // if not yet contained in the map else { float* nodeContent = new float[NC_NUM_ELEMENTS]; nodeContent[NC_DISTANCE] = dist; nodeContent[NC_NORMAL_X] = normal[0]; nodeContent[NC_NORMAL_Y] = normal[1]; nodeContent[NC_NORMAL_Z] = normal[2]; //std::cout << dist << std::endl; // just add val to the map map.add(coord, nodeContent); } } } } } } // // compute sign of distance // std::cout << "point in mesh test" << std::endl; PointInMeshTest test(mesh, 20); // for each coordinate in the signed distance field std::list<Coordinate>::const_iterator& it = mNodeContents.begin(); std::list<Coordinate>::const_iterator& end = mNodeContents.end(); Coordinate c; for (; it != end; it++) { // translate coordinate to world coordinate c = *it; x[0] = x0 + c.i*mDx; x[1] = y0 + c.j*mDx; x[2] = z0 + c.k*mDx; // if [x] is inside the mesh if (test.isContained(Vector3f(x[0], x[1], x[2]))) { // negate the distances in the signed distance field float* nodeContent; mNodeContents.get(nodeContent, c); nodeContent[NC_DISTANCE] = -nodeContent[NC_DISTANCE]; } } std::cout << "point in mesh test finished" << std::endl;}
开发者ID:segfault11,项目名称:CUDASPHNEW,代码行数:101,
示例2: pushvoid GPUDrawScanlineCodeGenerator::Generate(){ push(esi); push(edi); Init(); align(16);L("loop"); // GSVector4i test = m_test[7 + (steps & (steps >> 31))]; mov(edx, ecx); sar(edx, 31); and(edx, ecx); shl(edx, 4); movdqa(xmm7, ptr[edx + (size_t)&m_test[7]]); // movdqu(xmm1, ptr[edi]); movq(xmm1, qword[edi]); movhps(xmm1, qword[edi + 8]); // ecx = steps // esi = tex (tme) // edi = fb // xmm1 = fd // xmm2 = s // xmm3 = t // xmm4 = r // xmm5 = g // xmm6 = b // xmm7 = test TestMask(); SampleTexture(); // xmm1 = fd // xmm3 = a // xmm4 = r // xmm5 = g // xmm6 = b // xmm7 = test // xmm0, xmm2 = free ColorTFX(); AlphaBlend(); Dither(); WriteFrame();L("step"); // if(steps <= 0) break; test(ecx, ecx); jle("exit", T_NEAR); Step(); jmp("loop", T_NEAR);L("exit"); pop(edi); pop(esi); ret(8);}
开发者ID:docbray,项目名称:pcsx2-online,代码行数:74,
示例3: mainintmain(int argc, char **argv){ test(); return 0;}
开发者ID:mollaahmadi,项目名称:cpp-bad-security,代码行数:6,
示例4: inScopeExprPtr Parser::primaryExpression(bool se){ ExprPtr ret; /* TODO if(test(TMinus)) { return inScope(new UnaryExpr(PrimaryExpression(se), Token.Minus)); }*/ if(token == TCase) { ret = patternMatch(se); } else if (token == TIdent || token == TTypeIdent) { string const& name = nextIdent(se); auto varDecl = resolveLocal(currentScope, name); if(varDecl) ret = inScope(new VarRef(varDecl)); else ret = inScope(new NamedRef(name)); } else if(token == TConstNum) { if(tokenStr.find('.') != string::npos) ret = inScope(new FConstExpr(tokenNum(se))); else ret = inScope(new ConstExpr(tokenNum(se))); } else if(test(TLParen)) { ret = expression(false); expect(TRParen); } else if (firstControlSeq[token]) { ret = controlSeqExpression(se); } else { throw CompileError(CEParseError, currentLine); } while(true) { switch(token) { case TLParen: { next(false); auto call = inScope(new CallExpr()); call->func = ret; ret = call; if(token != TRParen) { do { ExprPtr const& param = expression(false); call->parameters.push_back(param); } while(test(TComma)); } expect(TRParen, se); break; } /* case Token.Dot: { Next(false); var name = ExpectIdent(se); ret = InScope(new SlotRef(ret, name)); break; }*/ default: return ret; } }}
开发者ID:gliptic,项目名称:milkshake,代码行数:88,
示例5: expectIntrusiveRefCntPtr<Module> Parser::module(){ mod = new Module; expect(TModule); expectPeek(TTypeIdent); mod->name = nextIdent(); expect(TLParen); if(token != TRParen) { do { if(token != TIdent && token != TTypeIdent) throw CompileError(CEUnexpectedToken, -1); string const& name = nextIdent(); mod->exportedSymbols.push_back(name); } while(test(TComma)); } expect(TRParen, true); do { if(test(TImport)) { expectPeek(TTypeIdent); string const& name = nextIdent(true); mod->imports.push_back(Import(name)); } else if(token != TSemicolon) // TODO: Make into set { break; } } while(test(TSemicolon)); do { if(token == TTypeIdent) { structBody(); } else if(token == TIdent) { enterTypeScope(); funcDef(true); exitTypeScope(); } else if(test(TClass)) { expectPeek(TTypeIdent); string const& name = nextIdent(false); IntrusiveRefCntPtr<Class> def(new Class(name)); enterTypeScope(); typeParamList(def->typeParams, false); expect(TLBrace); do { if (token == TIdent) { funcDef(false); } } while (test(TSemicolon)); expect(TRBrace, true); exitTypeScope(); mod->classDefs[def->name] = def; } } while(test(TSemicolon)); expect(TEof); return mod;}
开发者ID:gliptic,项目名称:milkshake,代码行数:88,
示例6: mainint main(){ test(XML{}); test(JSON{});}
开发者ID:CCJY,项目名称:coliru,代码行数:5,
示例7: mainint main(int, char**){ { typedef std::string S; test(S(""), 'c', 0, S::npos); test(S(""), 'c', 1, S::npos); test(S("abcde"), 'c', 0, 2); test(S("abcde"), 'c', 1, 2); test(S("abcde"), 'c', 2, 2); test(S("abcde"), 'c', 4, S::npos); test(S("abcde"), 'c', 5, S::npos); test(S("abcde"), 'c', 6, S::npos); test(S("abcdeabcde"), 'c', 0, 2); test(S("abcdeabcde"), 'c', 1, 2); test(S("abcdeabcde"), 'c', 5, 7); test(S("abcdeabcde"), 'c', 9, S::npos); test(S("abcdeabcde"), 'c', 10, S::npos); test(S("abcdeabcde"), 'c', 11, S::npos); test(S("abcdeabcdeabcdeabcde"), 'c', 0, 2); test(S("abcdeabcdeabcdeabcde"), 'c', 1, 2); test(S("abcdeabcdeabcdeabcde"), 'c', 10, 12); test(S("abcdeabcdeabcdeabcde"), 'c', 19, S::npos); test(S("abcdeabcdeabcdeabcde"), 'c', 20, S::npos); test(S("abcdeabcdeabcdeabcde"), 'c', 21, S::npos); test(S(""), 'c', S::npos); test(S("abcde"), 'c', 2); test(S("abcdeabcde"), 'c', 2); test(S("abcdeabcdeabcdeabcde"), 'c', 2); }#if TEST_STD_VER >= 11 { typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S; test(S(""), 'c', 0, S::npos); test(S(""), 'c', 1, S::npos); test(S("abcde"), 'c', 0, 2); test(S("abcde"), 'c', 1, 2); test(S("abcde"), 'c', 2, 2); test(S("abcde"), 'c', 4, S::npos); test(S("abcde"), 'c', 5, S::npos); test(S("abcde"), 'c', 6, S::npos); test(S("abcdeabcde"), 'c', 0, 2); test(S("abcdeabcde"), 'c', 1, 2); test(S("abcdeabcde"), 'c', 5, 7); test(S("abcdeabcde"), 'c', 9, S::npos); test(S("abcdeabcde"), 'c', 10, S::npos); test(S("abcdeabcde"), 'c', 11, S::npos); test(S("abcdeabcdeabcdeabcde"), 'c', 0, 2); test(S("abcdeabcdeabcdeabcde"), 'c', 1, 2); test(S("abcdeabcdeabcdeabcde"), 'c', 10, 12); test(S("abcdeabcdeabcdeabcde"), 'c', 19, S::npos); test(S("abcdeabcdeabcdeabcde"), 'c', 20, S::npos); test(S("abcdeabcdeabcdeabcde"), 'c', 21, S::npos); test(S(""), 'c', S::npos); test(S("abcde"), 'c', 2); test(S("abcdeabcde"), 'c', 2); test(S("abcdeabcdeabcdeabcde"), 'c', 2); }#endif return 0;}
开发者ID:ingowald,项目名称:llvm-project,代码行数:63,
示例8: testint MarketDefaultTest::testCfgDefaults(Value* stream){ return test(stream, &Tester::testCfgDefaults, mErrorLevel);}
开发者ID:DimondTheCat,项目名称:xray,代码行数:4,
示例9: Qua_gain/************************************************************************* * * FUNCTION: Qua_gain() * * PURPOSE: Quantization of pitch and codebook gains. * (using predicted codebook gain) * *************************************************************************/Word16Qua_gain( /* o : index of quantization. */ enum Mode mode, /* i : AMR mode */ Word16 exp_gcode0, /* i : predicted CB gain (exponent), Q0 */ Word16 frac_gcode0, /* i : predicted CB gain (fraction), Q15 */ Word16 frac_coeff[], /* i : energy coeff. (5), fraction part, Q15 */ Word16 exp_coeff[], /* i : energy coeff. (5), exponent part, Q0 */ /* (frac_coeff and exp_coeff computed in */ /* calc_filt_energies()) */ Word16 gp_limit, /* i : pitch gain limit */ Word16 *gain_pit, /* o : Pitch gain, Q14 */ Word16 *gain_cod, /* o : Code gain, Q1 */ Word16 *qua_ener_MR122, /* o : quantized energy error, Q10 */ /* (for MR122 MA predictor update) */ Word16 *qua_ener /* o : quantized energy error, Q10 */ /* (for other MA predictor update) */){ const Word16 *p; Word16 i, j, index = 0; Word16 gcode0, e_max, exp_code; Word16 g_pitch, g2_pitch, g_code, g2_code, g_pit_cod; Word16 coeff[5], coeff_lo[5]; Word16 exp_max[5]; Word32 L_tmp, dist_min; const Word16 *table_gain; Word16 table_len; test(); test(); test(); if ( sub (mode, MR102) == 0 || sub (mode, MR74) == 0 || sub (mode, MR67) == 0) { table_len = VQ_SIZE_HIGHRATES; move16 (); table_gain = table_gain_highrates; move16 (); } else { table_len = VQ_SIZE_LOWRATES; move16 (); table_gain = table_gain_lowrates; move16 (); } /*-------------------------------------------------------------------* * predicted codebook gain * * ~~~~~~~~~~~~~~~~~~~~~~~ * * gc0 = 2^exp_gcode0 + 2^frac_gcode0 * * * * gcode0 (Q14) = 2^14*2^frac_gcode0 = gc0 * 2^(14-exp_gcode0) * *-------------------------------------------------------------------*/ gcode0 = extract_l(Pow2(14, frac_gcode0)); /*-------------------------------------------------------------------* * Scaling considerations: * * ~~~~~~~~~~~~~~~~~~~~~~~ * *-------------------------------------------------------------------*/ /* * The error energy (sum) to be minimized consists of five terms, t[0..4]. * * t[0] = gp^2 * <y1 y1> * t[1] = -2*gp * <xn y1> * t[2] = gc^2 * <y2 y2> * t[3] = -2*gc * <xn y2> * t[4] = 2*gp*gc * <y1 y2> * */ /* determine the scaling exponent for g_code: ec = ec0 - 11 */ exp_code = sub(exp_gcode0, 11); /* calculate exp_max[i] = s[i]-1 */ exp_max[0] = sub(exp_coeff[0], 13); move16 (); exp_max[1] = sub(exp_coeff[1], 14); move16 (); exp_max[2] = add(exp_coeff[2], add(15, shl(exp_code, 1))); move16 (); exp_max[3] = add(exp_coeff[3], exp_code); move16 (); exp_max[4] = add(exp_coeff[4], add(1, exp_code)); move16 (); /*-------------------------------------------------------------------* * Find maximum exponent: * * ~~~~~~~~~~~~~~~~~~~~~~ * * * * For the sum operation, all terms must have the same scaling; * * that scaling should be low enough to prevent overflow. There- * * fore, the maximum scale is determined and all coefficients are * * re-scaled: * * * * e_max = max(exp_max[i]) + 1; * * e = exp_max[i]-e_max; e <= 0! * * c[i] = c[i]*2^e * *-------------------------------------------------------------------*/ e_max = exp_max[0]; move16 ();//.........这里部分代码省略.........
开发者ID:zrafa,项目名称:jlime_embedded_applications,代码行数:101,
示例10: mainint main(int argc, char *argv[]){ test("1", 0, 10, 1); test("0", -2, 5, 1); test("0", 2, 5, 0); test("0", 2, LLONG_MAX, 0); test("-2", 0, LLONG_MAX, 0); test("0", -5, LLONG_MAX, 1); test("-3", -3, LLONG_MAX, 1); test("-9223372036854775808", LLONG_MIN, LLONG_MAX, 1); test("9223372036854775807", LLONG_MIN, LLONG_MAX, 1); test("-9223372036854775809", LLONG_MIN, LLONG_MAX, 0); test("9223372036854775808", LLONG_MIN, LLONG_MAX, 0); test("1000000000000000000000000", LLONG_MIN, LLONG_MAX, 0); test("-1000000000000000000000000", LLONG_MIN, LLONG_MAX, 0); test("-2", 10, -1, 0); test("-2", -10, -1, 1); test("-20", -10, -1, 0); test("20", -10, -1, 0); return (fail);}
开发者ID:0x00evil,项目名称:obfuscated-openssh,代码行数:22,
示例11: close_dummystatic void close_dummy(void){ test(1 == 1);}
开发者ID:paulvlase,项目名称:mptp,代码行数:4,
示例12: whileint Detector::detect(IntegralImage &intg, int max_num, CB_RectT *pt_rects, int &subwin_count){ int image_w = intg.width; int image_h = intg.height; CB_PointT tpl_size = ptr_model->p_ft_param->getTemplateSize(); SubwinInfoT subwin; subwin.image_size.x = image_w; subwin.image_size.y = image_h; subwin.win_size = tpl_size; double cur_scan_scale = 1.0; int detection_count = 0; subwin_count = 0; while (subwin.win_size.x < image_w && subwin.win_size.y < image_h) { if (subwin.win_size.x < param.min_win_w || subwin.win_size.x > param.max_win_w) { cur_scan_scale *= param.scan_scale_step; subwin.win_size.x = tpl_size.x * cur_scan_scale; subwin.win_size.y = tpl_size.y * cur_scan_scale; continue; } subwin.win_pos.y = param.hot_rect.top; while (subwin.win_pos.y + subwin.win_size.y < param.hot_rect.bottom - 1) { subwin.win_pos.x = param.hot_rect.left; while (subwin.win_pos.x + subwin.win_size.x < param.hot_rect.right - 1) { subwin_count++; if (test(intg, subwin) <= 0) { subwin.win_pos.x += param.scan_shift_step * cur_scan_scale; continue; } CB_RectT rect; rect.left = subwin.win_pos.x; rect.right = rect.left + subwin.win_size.x - 1; rect.top = subwin.win_pos.y; rect.bottom = rect.top + subwin.win_size.y - 1; pt_rects[detection_count] = rect; detection_count++; if (detection_count >= max_num) { return detection_count; } subwin.win_pos.x += param.scan_shift_step * cur_scan_scale; } subwin.win_pos.y += param.scan_shift_step * cur_scan_scale; } cur_scan_scale *= param.scan_scale_step; subwin.win_size.x = tpl_size.x * cur_scan_scale; subwin.win_size.y = tpl_size.y * cur_scan_scale; } printf("%d/n", detection_count); return detection_count;}
开发者ID:Belial2010,项目名称:cascade-boosting,代码行数:62,
示例13: mainint main(int argc, const char * argv[]){ test();}
开发者ID:vladmazur,项目名称:CG-lab1,代码行数:4,
示例14: test// test streamsbool FBTestPluginAPI::testStreams(){ StreamsTest test( m_host ); return test.run();}
开发者ID:luigicalori,项目名称:FireBreath,代码行数:6,
示例15: mainintmain(){ test(); return boost::report_errors();}
开发者ID:HuangChunLinGit,项目名称:boost-doc-zh,代码行数:6,
示例16: switchint RssRegexpDlg::exec(){ int r; if(m_feeds.isEmpty() || g_queues.isEmpty()) return QDialog::Rejected; for(int i=0;i<m_feeds.size();i++) { comboFeed->addItem(m_feeds[i].name); comboFeed->setItemData(i, m_feeds[i].url); if(m_feeds[i].url == m_regexp.source) comboFeed->setCurrentIndex(i); } g_queuesLock.lockForRead(); for(int i=0;i<g_queues.size();i++) { comboQueue->addItem(g_queues[i]->name()); comboQueue->setItemData(i, g_queues[i]->uuid()); comboQueue->setItemData(i, g_queues[i]->defaultDirectory(), Qt::UserRole+1); if(g_queues[i]->uuid() == m_regexp.queueUUID) comboQueue->setCurrentIndex(i); } g_queuesLock.unlock(); if(m_regexp.target.isEmpty()) { m_nLastQueue = comboQueue->currentIndex(); if(m_nLastQueue != -1) m_regexp.target = comboQueue->itemData(m_nLastQueue, Qt::UserRole+1).toString(); else m_regexp.target = QDir::homePath(); } lineExpression->setText(m_regexp.regexp.pattern()); lineTarget->setText(m_regexp.target); switch(m_regexp.tvs) { case RssRegexp::None: radioTVSNone->setChecked(true); break; case RssRegexp::SeasonBased: radioTVSSeason->setChecked(true); break; case RssRegexp::EpisodeBased: radioTVSEpisode->setChecked(true); break; case RssRegexp::DateBased: radioTVSDate->setChecked(true); break; } lineTVSFrom->setText(m_regexp.from); lineTVSTo->setText(m_regexp.to); checkTVSRepacks->setChecked(m_regexp.includeRepacks); checkTVSTrailers->setChecked(m_regexp.includeTrailers); checkTVSNoManuals->setChecked(m_regexp.excludeManuals); checkAddPaused->setChecked(m_regexp.addPaused); if(!m_regexp.linkRegexp.isEmpty()) { radioParsingExtract->setChecked(true); lineParsingRegexp->setText(m_regexp.linkRegexp.pattern()); } connect(comboQueue, SIGNAL(currentIndexChanged(int)), this, SLOT(queueChanged(int))); test(); updateParsing(); if((r = QDialog::exec()) == QDialog::Accepted) { m_regexp.regexp = QRegExp(lineExpression->text(), Qt::CaseInsensitive); m_regexp.target = lineTarget->text(); m_regexp.queueUUID = comboQueue->itemData(comboQueue->currentIndex()).toString(); m_regexp.source = comboFeed->itemData(comboFeed->currentIndex()).toString(); m_regexp.from = lineTVSFrom->text(); m_regexp.to = lineTVSTo->text(); if(radioTVSNone->isChecked()) m_regexp.tvs = RssRegexp::None; else if(radioTVSSeason->isChecked()) m_regexp.tvs = RssRegexp::SeasonBased; else if(radioTVSEpisode->isChecked()) m_regexp.tvs = RssRegexp::EpisodeBased; else m_regexp.tvs = RssRegexp::DateBased; m_strFeedName = comboFeed->currentText(); m_regexp.includeRepacks = checkTVSRepacks->isChecked(); m_regexp.includeTrailers = checkTVSTrailers->isChecked(); m_regexp.excludeManuals = checkTVSNoManuals->isChecked(); m_regexp.addPaused = checkAddPaused->isChecked(); m_regexp.linkRegexp = QRegExp(lineParsingRegexp->text(), Qt::CaseInsensitive); } return r;//.........这里部分代码省略.........
开发者ID:ActionLuzifer,项目名称:fatrat,代码行数:101,
示例17: mainint main(){ MyTest test("ask"); test.run(); return 0;}
开发者ID:korslund,项目名称:spread,代码行数:6,
示例18: test_lcmvoidtest_lcm(void){ test(__FILE__, s, sizeof (s) / sizeof (char *));}
开发者ID:AnderainLovelace,项目名称:ForumlaZ-WH,代码行数:5,
示例19: run_static void run_(testcase* test, const char* name){ fprintf(stderr, "/n[ ******** STARTING TESTCASE '%s' ******** ]/n", name); reset_timers(); test();}
开发者ID:android-808,项目名称:dsme,代码行数:6,
示例20: initialize/** * /brief Start-Funktion der Testumgebung * * Diese Funktion wird einmal beim Starten der Testumgebung * aufgerufen. */TEFUNCvoid initialize(int /*argc*/, char** /*argv*/) { // --------- Ein wenig Testkram, ist unbedeutetnd ------------- orientationInit.normalize(); Quaternion test(0,M_PI/2,M_PI/2); cout << test << endl << M_PI/2 << endl << test.getEulerRotation() << endl;// exit (0); //----------------- uhr initialisieren -------------------- timer.init(); // --- Anlegen der Zeiger und Objekte mit denen gearbeitet werden soll ---- RigidBodyPtr body; GeometryPtr boxGeo; // Erste id ist null. Wird dann hochgez C++ test0函数代码示例 C++ terminated函数代码示例
|