您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ testcase函数代码示例

51自学网 2021-06-03 08:46:17
  C++
这篇教程C++ testcase函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中testcase函数的典型用法代码示例。如果您正苦于以下问题:C++ testcase函数的具体用法?C++ testcase怎么用?C++ testcase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了testcase函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: test_lhs_zero

    void    test_lhs_zero ()    {        testcase ("lhs zero");        test_lhs_zero(-7);        test_lhs_zero(0);        test_lhs_zero(32);    }
开发者ID:bachase,项目名称:rippled,代码行数:9,


示例2: fts3auxFilterMethod

/*** xFilter - Initialize a cursor to point at the start of its data.*/static int fts3auxFilterMethod(  sqlite3_vtab_cursor *pCursor,   /* The cursor used for this query */  int idxNum,                     /* Strategy index */  const char *idxStr,             /* Unused */  int nVal,                       /* Number of elements in apVal */  sqlite3_value **apVal           /* Arguments for the indexing scheme */){  Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor;  Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab;  int rc;  int isScan;  UNUSED_PARAMETER(nVal);  UNUSED_PARAMETER(idxStr);  assert( idxStr==0 );  assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0       || idxNum==FTS4AUX_LE_CONSTRAINT || idxNum==FTS4AUX_GE_CONSTRAINT       || idxNum==(FTS4AUX_LE_CONSTRAINT|FTS4AUX_GE_CONSTRAINT)  );  isScan = (idxNum!=FTS4AUX_EQ_CONSTRAINT);  /* In case this cursor is being reused, close and zero it. */  testcase(pCsr->filter.zTerm);  sqlite3Fts3SegReaderFinish(&pCsr->csr);  sqlite3_free((void *)pCsr->filter.zTerm);  sqlite3_free(pCsr->aStat);  memset(&pCsr->csr, 0, ((u8*)&pCsr[1]) - (u8*)&pCsr->csr);  pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY;  if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN;  if( idxNum&(FTS4AUX_EQ_CONSTRAINT|FTS4AUX_GE_CONSTRAINT) ){    const unsigned char *zStr = sqlite3_value_text(apVal[0]);    if( zStr ){      pCsr->filter.zTerm = sqlite3_mprintf("%s", zStr);      pCsr->filter.nTerm = sqlite3_value_bytes(apVal[0]);      if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM;    }  }  if( idxNum&FTS4AUX_LE_CONSTRAINT ){    int iIdx = (idxNum&FTS4AUX_GE_CONSTRAINT) ? 1 : 0;    pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iIdx]));    pCsr->nStop = sqlite3_value_bytes(apVal[iIdx]);    if( pCsr->zStop==0 ) return SQLITE_NOMEM;  }  rc = sqlite3Fts3SegReaderCursor(pFts3, 0, FTS3_SEGCURSOR_ALL,      pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr  );  if( rc==SQLITE_OK ){    rc = sqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter);  }  if( rc==SQLITE_OK ) rc = fts3auxNextMethod(pCursor);  return rc;}
开发者ID:AlexL871,项目名称:rt-thread-stm32f4discovery,代码行数:60,


示例3: testEndpoint

    void testEndpoint ()    {        testcase ("Endpoint");        {            std::pair <Endpoint, bool> result (                Endpoint::from_string_checked ("1.2.3.4"));            expect (result.second);            if (expect (result.first.address().is_v4 ()))            {                expect (result.first.address().to_v4() ==                    AddressV4 (1, 2, 3, 4));                expect (result.first.port() == 0);                expect (to_string (result.first) == "1.2.3.4");            }        }        {            std::pair <Endpoint, bool> result (                Endpoint::from_string_checked ("1.2.3.4:5"));            expect (result.second);            if (expect (result.first.address().is_v4 ()))            {                expect (result.first.address().to_v4() ==                    AddressV4 (1, 2, 3, 4));                expect (result.first.port() == 5);                expect (to_string (result.first) == "1.2.3.4:5");            }        }        Endpoint ep;        ep = Endpoint (AddressV4 (127,0,0,1), 80);        expect (! is_unspecified (ep));        expect (! is_public (ep));        expect (  is_private (ep));        expect (! is_multicast (ep));        expect (  is_loopback (ep));        expect (to_string (ep) == "127.0.0.1:80");        ep = Endpoint (AddressV4 (10,0,0,1));        expect (AddressV4::get_class (ep.to_v4()) == 'A');        expect (! is_unspecified (ep));        expect (! is_public (ep));        expect (  is_private (ep));        expect (! is_multicast (ep));        expect (! is_loopback (ep));        expect (to_string (ep) == "10.0.0.1");        ep = Endpoint (AddressV4 (166,78,151,147));        expect (! is_unspecified (ep));        expect (  is_public (ep));        expect (! is_private (ep));        expect (! is_multicast (ep));        expect (! is_loopback (ep));        expect (to_string (ep) == "166.78.151.147");    }
开发者ID:BitHighlander,项目名称:rippled,代码行数:57,


示例4: test_containers

 void test_containers() {     testcase ("containers");     check_container <detail::test_hardened_unordered_set>();     check_container <detail::test_hardened_unordered_map>();     check_container <detail::test_hardened_unordered_multiset>();     check_container <detail::test_hardened_unordered_multimap>(); }
开发者ID:mellery451,项目名称:rippled,代码行数:9,


示例5: zeroblobFunc

/*** The zeroblob(N) function returns a zero-filled blob of size N bytes.*/static void zeroblobFunc(  sqlite3_context *context,  int argc,  sqlite3_value **argv){  i64 n;  sqlite3 *db = sqlite3_context_db_handle(context);  assert( argc==1 );  UNUSED_PARAMETER(argc);  n = sqlite3_value_int64(argv[0]);  testcase( n==db->aLimit[SQLITE_LIMIT_LENGTH] );  testcase( n==db->aLimit[SQLITE_LIMIT_LENGTH]+1 );  if( n>db->aLimit[SQLITE_LIMIT_LENGTH] ){    sqlite3_result_error_toobig(context);  }else{    sqlite3_result_zeroblob(context, (int)n); /* IMP: R-00293-64994 */  }}
开发者ID:blingstorm,项目名称:sqlcipher,代码行数:21,


示例6: sqlite3WalkExpr

int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){  int rc;  if( pExpr==0 ) return WRC_Continue;  testcase( ExprHasProperty(pExpr, EP_TokenOnly) );  testcase( ExprHasProperty(pExpr, EP_Reduced) );  rc = pWalker->xExprCallback(pWalker, pExpr);  if( rc==WRC_Continue              && !ExprHasAnyProperty(pExpr,EP_TokenOnly) ){    if( sqlite3WalkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;    if( sqlite3WalkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;    if( ExprHasProperty(pExpr, EP_xIsSelect) ){      if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;    }else{      if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;    }  }  return rc & WRC_Abort;}
开发者ID:qtekfun,项目名称:htcDesire820Kernel,代码行数:18,


示例7: main

int main(int argc, char *argv[]){    int i;        for (i = 0; i < 10; i++)        testcase();        return 0;}
开发者ID:wj32,项目名称:Judge,代码行数:9,


示例8: sqlite3ExprAlloc

/*** Allocate and return a pointer to an expression to load the column iCol** from datasource iSrc in SrcList pSrc.*/Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){  Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);  if( p ){    struct SrcList_item *pItem = &pSrc->a[iSrc];    p->pTab = pItem->pTab;    p->iTable = pItem->iCursor;    if( p->pTab->iPKey==iCol ){      p->iColumn = -1;    }else{      p->iColumn = (ynVar)iCol;      testcase( iCol==BMS );      testcase( iCol==BMS-1 );      pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);    }    ExprSetProperty(p, EP_Resolved);  }  return p;}
开发者ID:Oceanwings,项目名称:sqlcipher,代码行数:22,


示例9: test_rhs_zero

    void    test_rhs_zero ()    {        testcase ("rhs zero");        test_rhs_zero(-4);        test_rhs_zero(0);        test_rhs_zero(64);    }
开发者ID:bachase,项目名称:rippled,代码行数:9,


示例10: check_err

void check_err(Complexf* a,int*n,MPI_Comm c_comm){  int nprocs, procid;  MPI_Comm_rank(c_comm, &procid);  MPI_Comm_size(c_comm,&nprocs);  long long int size=n[0];  size*=n[1]; size*=n[2];  float pi=M_PI;  int istart[3], isize[3], osize[3],ostart[3];  accfft_local_size_dft_c2cf(n,isize,istart,osize,ostart,c_comm);  float err=0,norm=0;  float X,Y,Z,numerical_r,numerical_c;  long int ptr;  int thid=omp_get_thread_num();  for (int i=0; i<isize[0]; i++){    for (int j=0; j<isize[1]; j++){      for (int k=0; k<isize[2]; k++){        X=2*pi/n[0]*(i+istart[0]);        Y=2*pi/n[1]*(j+istart[1]);        Z=2*pi/n[2]*k;        ptr=i*isize[1]*n[2]+j*n[2]+k;        numerical_r=a[ptr][0]/size; if(numerical_r!=numerical_r) numerical_r=0;        numerical_c=a[ptr][1]/size; if(numerical_c!=numerical_c) numerical_c=0;        err+=std::abs(numerical_r-testcase(X,Y,Z))+std::abs(numerical_c-testcase(X,Y,Z));        norm+=std::abs(testcase(X,Y,Z));      }    }  }  float g_err=0,g_norm=0;  MPI_Reduce(&err,&g_err,1, MPI_FLOAT, MPI_SUM,0, MPI_COMM_WORLD);  MPI_Reduce(&norm,&g_norm,1, MPI_FLOAT, MPI_SUM,0, MPI_COMM_WORLD);  PCOUT<<"/nL1 Error of iFF(a)-a: "<<g_err<<std::endl;  PCOUT<<"Relative L1 Error of iFF(a)-a: "<<g_err/g_norm<<std::endl;  if (g_err/g_norm< 1e-5)    PCOUT<<"/nResults are CORRECT! (upto single precision)/n/n";  else    PCOUT<<"/nResults are NOT CORRECT!/n/n";  return;} // end check_err
开发者ID:jeffhammond,项目名称:accfft,代码行数:44,


示例11: run

    void run ()    {        TagInt1 const zero (0);        TagInt1 const one (1);        testcase ("Comparison Operators");        expect (zero >= zero, "Should be greater than or equal");        expect (zero == zero, "Should be equal");        expect (one > zero, "Should be greater");        expect (one >= zero, "Should be greater than or equal");        expect (one != zero, "Should not be equal");        unexpected (one < zero, "Should be greater");        unexpected (one <= zero, "Should not be greater than or equal");        unexpected (one == zero, "Should not be equal");        testcase ("Arithmetic Operators");        TagInt1 tmp;        tmp = zero + 0u;        expect (tmp == zero, "Should be equal");        tmp = 1u + zero;        expect (tmp == one, "Should be equal");        expect(--tmp == zero, "Should be equal");        expect(tmp++ == zero, "Should be equal");        expect(tmp == one, "Should be equal");        expect(tmp-- == one, "Should be equal");        expect(tmp == zero, "Should be equal");        expect(++tmp == one, "Should be equal");        tmp = zero;        tmp += 1u;        expect(tmp == one, "Should be equal");        tmp -= 1u;        expect(tmp == zero, "Should be equal");    }
开发者ID:CFQuantum,项目名称:CFQuantumd,代码行数:44,


示例12: testConversionUnderflows

    void testConversionUnderflows ()    {        testcase ("conversion underflows");        tryBadConvert <std::uint32_t> ("-1");        tryBadConvert <std::int64_t> ("-99999999999999999999");        tryBadConvert <std::int32_t> ("-4294967300");        tryBadConvert <std::int16_t> ("-75821");    }
开发者ID:619213152,项目名称:vpal20,代码行数:10,


示例13: testPassphrase

 void testPassphrase() {     testcase ("generation from passphrase");     BEAST_EXPECT(testPassphrase ("masterpassphrase") ==                  "snoPBrXtMeMyMHUVTgbuqAfg1SUTb");     BEAST_EXPECT(testPassphrase ("Non-Random Passphrase") ==                  "snMKnVku798EnBwUfxeSD8953sLYA");     BEAST_EXPECT(testPassphrase ("cookies excitement hand public") ==                  "sspUXGrmjQhq6mgc24jiRuevZiwKT"); }
开发者ID:ripple,项目名称:rippled,代码行数:10,


示例14: testAddress

    void testAddress ()    {        testcase ("Address");        std::pair <Address, bool> result (            Address::from_string ("1.2.3.4"));        expect (result.second);        if (expect (result.first.is_v4 ()))            expect (result.first.to_v4() == AddressV4 (1, 2, 3, 4));    }
开发者ID:bachase,项目名称:rippled,代码行数:10,


示例15: assert

/*** Allocate or return the aggregate context for a user function.  A new** context is allocated on the first call.  Subsequent calls return the** same context that was returned on prior calls.*/void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){  assert( p && p->pFunc && p->pFunc->xStep );  assert( sqlite3_mutex_held(p->pOut->db->mutex) );  testcase( nByte<0 );  if( (p->pMem->flags & MEM_Agg)==0 ){    return createAggContext(p, nByte);  }else{    return (void*)p->pMem->z;  }}
开发者ID:Farteen,项目名称:firefox-ios,代码行数:15,


示例16: main

int main(int argc, char** args){	hashTable = (char**)malloc(MAX_SIZE*sizeof(char**));	int t;	scanf("%d/n", &t);	while(t-->0)		testcase();	return 0;}
开发者ID:schiermike,项目名称:algo_puzzles,代码行数:11,


示例17: main

int main(void) {	int testcase_count = 0;	scanf("%d",&testcase_count);		int i = 0, j =0;	for ( i=0; i< testcase_count; i++) {		testcase();	}		return 0;}
开发者ID:pushpraj,项目名称:programming-problems,代码行数:11,


示例18: START_TEST

END_TESTSTART_TEST (test_case2){    char * retout;    char testbuf[][10] = {"XX","II"};    char *resultbuf = "XXII";    retout = testcase(testbuf,resultbuf);    fail_unless ( !strcmp(retout,resultbuf), "test case2 error!!" );}
开发者ID:HGboda,项目名称:calc_exam,代码行数:11,


示例19: testPathologies

 void testPathologies() {     testcase("pathologies");     try     {         lexicalCastThrow<int>("/xef/xbc/x91/xef/xbc/x90"); // utf-8 encoded     }     catch(BadLexicalCast const&)     {         pass();     } }
开发者ID:619213152,项目名称:vpal20,代码行数:12,


示例20: testValues

    void testValues ()    {        testcase ("comparison");        expect (from_version (1,2) == from_version (1,2));        expect (from_version (3,4) >= from_version (3,4));        expect (from_version (5,6) <= from_version (5,6));        expect (from_version (7,8) >  from_version (6,7));        expect (from_version (7,8) <  from_version (8,9));        expect (from_version (65535,0) <  from_version (65535,65535));        expect (from_version (65535,65535) >= from_version (65535,65535));    }
开发者ID:xdv,项目名称:divvyd,代码行数:12,


示例21: run

    void run()    {        testcase ("Currency");        testUnsigned <Currency> ();        testcase ("Account");        testUnsigned <Account> ();        // ---        testcase ("Issue");        testIssueType <Issue> ();        testcase ("IssueRef");        testIssueType <IssueRef> ();        testIssueSets ();        testIssueMaps ();        // ---        testcase ("Book");        testBook <Book> ();        testcase ("BookRef");        testBook <BookRef> ();        testBookSets ();        testBookMaps ();    }
开发者ID:BobWay,项目名称:rippled,代码行数:30,


示例22: testStringVersion

    void testStringVersion ()    {        testcase ("string version");        for (std::uint16_t major = 0; major < 8; major++)        {            for (std::uint16_t minor = 0; minor < 8; minor++)            {                expect (to_string (from_version (major, minor)) ==                    std::to_string (major) + "." + std::to_string (minor));            }        }    }
开发者ID:xdv,项目名称:divvyd,代码行数:13,


示例23: testCompare

    void testCompare ()    {        testcase ("comparisons");        checkLess ("1.0.0-alpha", "1.0.0-alpha.1");        checkLess ("1.0.0-alpha.1", "1.0.0-alpha.beta");        checkLess ("1.0.0-alpha.beta", "1.0.0-beta");        checkLess ("1.0.0-beta", "1.0.0-beta.2");        checkLess ("1.0.0-beta.2", "1.0.0-beta.11");        checkLess ("1.0.0-beta.11", "1.0.0-rc.1");        checkLess ("1.0.0-rc.1", "1.0.0");        checkLess ("0.9.9", "1.0.0");    }
开发者ID:E-LLP,项目名称:rippled,代码行数:13,


示例24: testRandom

    void testRandom()    {        testcase ("random generation");        for (int i = 0; i < 32; i++)        {            auto const seed1 = randomSeed ();            auto const seed2 = parseBase58<Seed>(toBase58(seed1));            BEAST_EXPECT(static_cast<bool>(seed2));            BEAST_EXPECT(equal (seed1, *seed2));        }    }
开发者ID:ripple,项目名称:rippled,代码行数:13,


示例25: run

    void run ()    {        testcase ("Seed");        RippleAddress seed;        expect (seed.setSeedGeneric ("masterpassphrase"));        expect (seed.humanSeed () == "snoPBrXtMeMyMHUVTgbuqAfg1SUTb", seed.humanSeed ());        testcase ("RipplePublicKey");        RippleAddress deprecatedPublicKey (RippleAddress::createNodePublic (seed));        expect (deprecatedPublicKey.humanNodePublic () ==            "n94a1u4jAz288pZLtw6yFWVbi89YamiC6JBXPVUj5zmExe5fTVg9",                deprecatedPublicKey.humanNodePublic ());        RipplePublicKey publicKey = deprecatedPublicKey.toPublicKey();        expect (publicKey.to_string() == deprecatedPublicKey.humanNodePublic(),            publicKey.to_string());        testcase ("Generator");        RippleAddress generator (RippleAddress::createGeneratorPublic (seed));        expect (generator.humanGenerator () ==            "fhuJKrhSDzV2SkjLn9qbwm5AaRmrxDPfFsHDCP6yfDZWcxDFz4mt",                generator.humanGenerator ());    }
开发者ID:BobWay,项目名称:rippled,代码行数:22,


示例26: sqlite3VdbeMemReleaseExternal

/*** If the memory cell contains a string value that must be freed by** invoking an external callback, free it now. Calling this function** does not free any Mem.zMalloc buffer.*/void sqlite3VdbeMemReleaseExternal(Mem *p){  assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) );  testcase( p->flags & MEM_Agg );  testcase( p->flags & MEM_Dyn );  testcase( p->flags & MEM_RowSet );  testcase( p->flags & MEM_Frame );  if( p->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame) ){    if( p->flags&MEM_Agg ){      sqlite3VdbeMemFinalize(p, p->u.pDef);      assert( (p->flags & MEM_Agg)==0 );      sqlite3VdbeMemRelease(p);    }else if( p->flags&MEM_Dyn && p->xDel ){      assert( (p->flags&MEM_RowSet)==0 );      p->xDel((void *)p->z);      p->xDel = 0;    }else if( p->flags&MEM_RowSet ){      sqlite3RowSetClear(p->u.pRowSet);    }else if( p->flags&MEM_Frame ){      sqlite3VdbeMemSetNull(p);    }  }}
开发者ID:bhanug,项目名称:likewise-open,代码行数:27,


示例27: SQLITE_MALLOC

/*** Like malloc(), but remember the size of the allocation** so that we can find it later using sqlite3MemSize().**** For this low-level routine, we are guaranteed that nByte>0 because** cases of nByte<=0 will be intercepted and dealt with by higher level** routines.*/static void *sqlite3MemMalloc(int nByte){#ifdef SQLITE_MALLOCSIZE  void *p = SQLITE_MALLOC( nByte );  if( p==0 ){    testcase( sqlite3GlobalConfig.xLog!=0 );    sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);  }  return p;#else  sqlite3_int64 *p;  assert( nByte>0 );  nByte = ROUND8(nByte);  p = SQLITE_MALLOC( nByte+8 );  if( p ){    p[0] = nByte;    p++;  }else{    testcase( sqlite3GlobalConfig.xLog!=0 );    sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte);  }  return (void *)p;#endif}
开发者ID:0xr0ot,项目名称:sqlcipher,代码行数:31,



注:本文中的testcase函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tester函数代码示例
C++ testbit函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。