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

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

51自学网 2021-06-01 19:37:48
  C++
这篇教程C++ ASSERT_NOT_OK函数代码示例写得很实用,希望能帮到您。

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

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

示例1: TEST_F

TEST_F(ViewCatalogFixture, CreateViewCycles) {    {        const NamespaceString viewName("db.view1");        const NamespaceString viewOn("db.view1");        ASSERT_NOT_OK(            viewCatalog.createView(opCtx.get(), viewName, viewOn, emptyPipeline, emptyCollation));    }    {        const NamespaceString view1("db.view1");        const NamespaceString view2("db.view2");        const NamespaceString view3("db.view3");        ASSERT_OK(viewCatalog.createView(opCtx.get(), view1, view2, emptyPipeline, emptyCollation));        ASSERT_OK(viewCatalog.createView(opCtx.get(), view2, view3, emptyPipeline, emptyCollation));        ASSERT_NOT_OK(            viewCatalog.createView(opCtx.get(), view3, view1, emptyPipeline, emptyCollation));    }}
开发者ID:Machyne,项目名称:mongo,代码行数:20,


示例2: TEST

TEST(QueryRequestTest, ForbidNonMetaSortOnFieldWithMetaProject) {    QueryRequest badQR(testns);    badQR.setProj(fromjson("{a: {$meta: /"textScore/"}}"));    badQR.setSort(fromjson("{a: 1}"));    ASSERT_NOT_OK(badQR.validate());    QueryRequest goodQR(testns);    goodQR.setProj(fromjson("{a: {$meta: /"textScore/"}}"));    goodQR.setSort(fromjson("{b: 1}"));    ASSERT_OK(goodQR.validate());}
开发者ID:ShaneHarvey,项目名称:mongo,代码行数:11,


示例3: TEST

TEST(MatchExpressionParserTest, ExprFailsToParseWithinTopLevelOr) {    auto query = fromjson("{$or: [{x: 1}, {$expr: {$eq: ['$a', 5]}}]}");    const CollatorInterface* collator = nullptr;    const boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest());    ASSERT_NOT_OK(MatchExpressionParser::parse(query,                                               collator,                                               expCtx,                                               ExtensionsCallbackNoop(),                                               MatchExpressionParser::AllowedFeatures::kExpr)                      .getStatus());}
开发者ID:akira-kurogane,项目名称:mongo,代码行数:11,


示例4: TEST

TEST(DataRangeCursor, ConstDataRangeCursor) {    char buf[14];    DataView(buf).write<uint16_t>(1);    DataView(buf).write<LittleEndian<uint32_t>>(2, sizeof(uint16_t));    DataView(buf).write<BigEndian<uint64_t>>(3, sizeof(uint16_t) + sizeof(uint32_t));    ConstDataRangeCursor cdrc(buf, buf + sizeof(buf));    ConstDataRangeCursor backup(cdrc);    ASSERT_EQUALS(static_cast<uint16_t>(1), cdrc.readAndAdvance<uint16_t>());    ASSERT_EQUALS(static_cast<uint32_t>(2), cdrc.readAndAdvance<LittleEndian<uint32_t>>());    ASSERT_EQUALS(static_cast<uint64_t>(3), cdrc.readAndAdvance<BigEndian<uint64_t>>());    ASSERT_NOT_OK(cdrc.readAndAdvanceNoThrow<char>());    // test skip()    cdrc = backup;    ASSERT_OK(cdrc.skipNoThrow<uint32_t>());    ASSERT_OK(cdrc.advanceNoThrow(10));    ASSERT_NOT_OK(cdrc.readAndAdvanceNoThrow<char>());}
开发者ID:acmorrow,项目名称:mongo,代码行数:21,


示例5: run

    void run() {        // "storageEngine" field has to be an object if present.        ASSERT_NOT_OK(createIndex("unittest", _createSpec(12345)));        // 'storageEngine' must not be empty.        ASSERT_NOT_OK(createIndex("unittest", _createSpec(BSONObj())));        // Every field under "storageEngine" must match a registered storage engine.        ASSERT_NOT_OK(createIndex("unittest", _createSpec(BSON("unknownEngine" << BSONObj()))));        // Testing with 'wiredTiger' because the registered storage engine factory        // supports custom index options under 'storageEngine'.        const std::string storageEngineName = "wiredTiger";        // Run 'wiredTiger' tests if the storage engine is supported.        if (isRegisteredStorageEngine(getGlobalServiceContext(), storageEngineName)) {            // Every field under "storageEngine" has to be an object.            ASSERT_NOT_OK(createIndex("unittest", _createSpec(BSON(storageEngineName << 1))));            // Storage engine options must pass validation by the storage engine factory.            // For 'wiredTiger', embedded document must contain 'configString'.            ASSERT_NOT_OK(createIndex(                "unittest", _createSpec(BSON(storageEngineName << BSON("unknown" << 1)))));            // Configuration string for 'wiredTiger' must be a string.            ASSERT_NOT_OK(createIndex(                "unittest", _createSpec(BSON(storageEngineName << BSON("configString" << 1)))));            // Valid 'wiredTiger' configuration.            ASSERT_OK(createIndex(                "unittest",                _createSpec(BSON(storageEngineName << BSON("configString"                                                           << "block_compressor=zlib")))));        }    }
开发者ID:guoyr,项目名称:mongo,代码行数:35,


示例6: TEST

    // Insert the same key multiple times and verify that only 1 entry exists    // in the index when duplicates are not allowed.    TEST( SortedDataInterface, InsertSameKey ) {        scoped_ptr<HarnessHelper> harnessHelper( newHarnessHelper() );        scoped_ptr<SortedDataInterface> sorted( harnessHelper->newSortedDataInterface() );        {            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );            ASSERT( sorted->isEmpty( opCtx.get() ) );        }        {            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );            {                WriteUnitOfWork uow( opCtx.get() );                ASSERT_OK( sorted->insert( opCtx.get(), key1, loc1, false ) );                ASSERT_NOT_OK( sorted->insert( opCtx.get(), key1, loc2, false ) );                uow.commit();            }        }        {            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );            ASSERT_EQUALS( 1, sorted->numEntries( opCtx.get() ) );        }        {            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );            {                WriteUnitOfWork uow( opCtx.get() );                ASSERT_NOT_OK( sorted->insert( opCtx.get(), key1, loc2, false ) );                uow.commit();            }        }        {            scoped_ptr<OperationContext> opCtx( harnessHelper->newOperationContext() );            ASSERT_EQUALS( 1, sorted->numEntries( opCtx.get() ) );        }    }
开发者ID:ANTco,项目名称:mongo,代码行数:40,


示例7: TEST

TEST(CollectionOptions, Validator) {    CollectionOptions options;    ASSERT_NOT_OK(options.parse(fromjson("{validator: 'notAnObject'}")));    ASSERT_OK(options.parse(fromjson("{validator: {a: 1}}")));    ASSERT_BSONOBJ_EQ(options.validator, fromjson("{a: 1}"));    options.validator = fromjson("{b: 1}");    ASSERT_BSONOBJ_EQ(options.toBSON()["validator"].Obj(), fromjson("{b: 1}"));    CollectionOptions defaultOptions;    ASSERT_BSONOBJ_EQ(defaultOptions.validator, BSONObj());    ASSERT(!defaultOptions.toBSON()["validator"]);}
开发者ID:bjori,项目名称:mongo,代码行数:15,


示例8: TEST

TEST(CollectionOptions, SizeNumberLimits) {    CollectionOptions options;    ASSERT_OK(options.parse(fromjson("{size: 'a'}")));    ASSERT_EQ(options.cappedSize, 0);    ASSERT_OK(options.parse(fromjson("{size: '-1'}")));    ASSERT_EQ(options.cappedSize, 0);    ASSERT_OK(options.parse(fromjson("{size: '-9999999999999999999999999999999'}")));    ASSERT_EQ(options.cappedSize, 0);    // The test for size is redundant since size returns a status that's not ok if it's larger    // than a petabyte, which is smaller than LLONG_MAX anyways. We test that here.    ASSERT_NOT_OK(options.parse(fromjson("{size: 9999999999999999}")));}
开发者ID:acmorrow,项目名称:mongo,代码行数:16,


示例9: TEST

// Test a bad fileTEST(FTDCFileTest, TestBadFile) {    unittest::TempDir tempdir("metrics_testpath");    boost::filesystem::path p(tempdir.path());    p /= kTestFile;    std::ofstream stream(p.c_str());    // This test case caused us to allocate more memory then the size of the file the first time I    // tried it    stream << "Hello World";    stream.close();    FTDCFileReader reader;    ASSERT_OK(reader.open(p));    auto sw = reader.hasNext();    ASSERT_NOT_OK(sw);}
开发者ID:mihail812,项目名称:mongo,代码行数:19,


示例10: TEST_F

TEST_F(ViewCatalogFixture, ExceedMaxViewDepthInOrder) {    const char* ns = "db.view";    int i = 0;    for (; i < ViewGraph::kMaxViewDepth; i++) {        const NamespaceString viewName(str::stream() << ns << i);        const NamespaceString viewOn(str::stream() << ns << (i + 1));        ASSERT_OK(            viewCatalog.createView(opCtx.get(), viewName, viewOn, emptyPipeline, emptyCollation));    }    const NamespaceString viewName(str::stream() << ns << i);    const NamespaceString viewOn(str::stream() << ns << (i + 1));    ASSERT_NOT_OK(        viewCatalog.createView(opCtx.get(), viewName, viewOn, emptyPipeline, emptyCollation));}
开发者ID:ksuarz,项目名称:mongo,代码行数:18,


示例11: TEST_F

TEST_F(KVStorageEngineTest, ReconcileIdentsTest) {    auto opCtx = cc().makeOperationContext();    // Add a collection, `db.coll1` to both the KVCatalog and KVEngine. The returned value is the    // `ident` name given to the collection.    auto swIdentName = createCollection(opCtx.get(), NamespaceString("db.coll1"));    ASSERT_OK(swIdentName);    // Create a table in the KVEngine not reflected in the KVCatalog. This should be dropped when    // reconciling.    ASSERT_OK(createCollTable(opCtx.get(), NamespaceString("db.coll2")));    ASSERT_OK(reconcile(opCtx.get()).getStatus());    auto identsVec = getAllKVEngineIdents(opCtx.get());    auto idents = std::set<std::string>(identsVec.begin(), identsVec.end());    // There are two idents. `_mdb_catalog` and the ident for `db.coll1`.    ASSERT_EQUALS(static_cast<const unsigned long>(2), idents.size());    ASSERT_TRUE(idents.find(swIdentName.getValue()) != idents.end());    ASSERT_TRUE(idents.find("_mdb_catalog") != idents.end());    // Create a catalog entry for the `_id` index. Drop the created the table.    ASSERT_OK(createIndex(opCtx.get(), NamespaceString("db.coll1"), "_id"));    ASSERT_OK(dropIndexTable(opCtx.get(), NamespaceString("db.coll1"), "_id"));    // The reconcile response should include this index as needing to be rebuilt.    auto reconcileStatus = reconcile(opCtx.get());    ASSERT_OK(reconcileStatus.getStatus());    ASSERT_EQUALS(static_cast<const unsigned long>(1), reconcileStatus.getValue().size());    StorageEngine::CollectionIndexNamePair& toRebuild = reconcileStatus.getValue()[0];    ASSERT_EQUALS("db.coll1", toRebuild.first);    ASSERT_EQUALS("_id", toRebuild.second);    // Now drop the `db.coll1` table, while leaving the KVCatalog entry.    ASSERT_OK(dropIdent(opCtx.get(), swIdentName.getValue()));    ASSERT_EQUALS(static_cast<const unsigned long>(1), getAllKVEngineIdents(opCtx.get()).size());    // Reconciling this should result in an error.    reconcileStatus = reconcile(opCtx.get());    ASSERT_NOT_OK(reconcileStatus.getStatus());    ASSERT_EQUALS(ErrorCodes::UnrecoverableRollbackError, reconcileStatus.getStatus());}
开发者ID:DINKIN,项目名称:mongo,代码行数:38,


示例12: run

 void run() {     // Create a new collection.     Database* db = _ctx.ctx().db();     db->dropCollection( _ns );     Collection* coll = db->createCollection( _ns );     // Drop all indexes including id index.     coll->getIndexCatalog()->dropAllIndexes( true );     // Insert some documents with enforceQuota=true.     int32_t nDocs = 1000;     for( int32_t i = 0; i < nDocs; ++i ) {         coll->insertDocument( BSON( "a" << i ), true );     }     // Initialize curop.     cc().curop()->reset();     // Request an interrupt.     killCurrentOp.killAll();     BSONObj indexInfo = BSON( "key" << BSON( "a" << 1 ) << "ns" << _ns << "name" << "a_1" );     // The call is interrupted because mayInterrupt == true.     Status status = coll->getIndexCatalog()->createIndex( indexInfo, true );     ASSERT_NOT_OK( status.code() );     // The new index is not listed in the index catalog because the index build failed.     ASSERT( !coll->getIndexCatalog()->findIndexByName( "a_1" ) ); }
开发者ID:dstorch,项目名称:mongo,代码行数:23,


示例13: run

        void run() {            Client::WriteContext ctx(&_txn, ns());            addIndex(BSON("a" << "2d" << "b" << 1));            addIndex(BSON("a" << "2d"));            BSONObj query = fromjson("{$or: [{a: {$geoWithin: {$centerSphere: [[0,0],10]}}},"                                            "{a: {$geoWithin: {$centerSphere: [[1,1],10]}}}]}");            CanonicalQuery* cq;            ASSERT_OK(CanonicalQuery::canonicalize(ns(), query, &cq));            Collection* collection = ctx.ctx().db()->getCollection(&_txn, ns());            // Get planner params.            QueryPlannerParams plannerParams;            fillOutPlannerParams(&_txn, collection, cq, &plannerParams);            // We expect creation of the subplan stage to fail.            WorkingSet ws;            SubplanStage* subplan;            ASSERT_NOT_OK(SubplanStage::make(&_txn, collection, &ws, plannerParams, cq, &subplan));            ctx.commit();        }
开发者ID:ANTco,项目名称:mongo,代码行数:24,


示例14: TEST

TEST(SSLManager, MongoDBRolesParser) {    /*    openssl asn1parse -genconf mongodbroles.cnf -out foo.der    -------- mongodbroles.cnf --------    asn1 = SET:MongoDBAuthorizationGrant    [MongoDBAuthorizationGrant]    grant1 = SEQUENCE:MongoDBRole    [MongoDBRole]    role  = UTF8:role_name    database = UTF8:Third field    */    // Positive: Simple parsing test    {        unsigned char derData[] = {0x31, 0x1a, 0x30, 0x18, 0x0c, 0x09, 0x72, 0x6f, 0x6c, 0x65,                                   0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x0c, 0x0b, 0x54, 0x68, 0x69,                                   0x72, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64};        auto swPeer = parsePeerRoles(ConstDataRange(reinterpret_cast<char*>(derData),                                                    std::extent<decltype(derData)>::value));        ASSERT_OK(swPeer.getStatus());        auto item = *(swPeer.getValue().begin());        ASSERT_EQ(item.getRole(), "role_name");        ASSERT_EQ(item.getDB(), "Third field");    }    // Positive: Very long role_name, and long form lengths    {        unsigned char derData[] = {            0x31, 0x82, 0x01, 0x3e, 0x30, 0x82, 0x01, 0x3a, 0x0c, 0x82, 0x01, 0x29, 0x72, 0x6f,            0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61,            0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c,            0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d,            0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65,            0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65,            0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f,            0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72,            0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e,            0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f,            0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61,            0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c,            0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d,            0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65,            0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65,            0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f,            0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72,            0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e,            0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f,            0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61,            0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c,            0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x72, 0x6f, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d,            0x65, 0x0c, 0x0b, 0x54, 0x68, 0x69, 0x72, 0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64};        auto swPeer = parsePeerRoles(ConstDataRange(reinterpret_cast<char*>(derData),                                                    std::extent<decltype(derData)>::value));        ASSERT_OK(swPeer.getStatus());        auto item = *(swPeer.getValue().begin());        ASSERT_EQ(item.getRole(),                  "role_namerole_namerole_namerole_namerole_namerole_namerole_namerole_namerole_"                  "namerole_namerole_namerole_namerole_namerole_namerole_namerole_namerole_"                  "namerole_namerole_namerole_namerole_namerole_namerole_namerole_namerole_"                  "namerole_namerole_namerole_namerole_namerole_namerole_namerole_namerole_name");        ASSERT_EQ(item.getDB(), "Third field");    }    // Negative: Encode MAX_INT64 into a length    {        unsigned char derData[] = {0x31, 0x88, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,                                   0xff, 0x3e, 0x18, 0x0c, 0x09, 0x72, 0x6f, 0x6c, 0x65, 0x5f,                                   0x6e, 0x61, 0x6d, 0x65, 0x0c, 0x0b, 0x54, 0x68, 0x69, 0x72,                                   0x64, 0x20, 0x66, 0x69, 0x65, 0x6c, 0x64};        auto swPeer = parsePeerRoles(ConstDataRange(reinterpret_cast<char*>(derData),                                                    std::extent<decltype(derData)>::value));        ASSERT_NOT_OK(swPeer.getStatus());    }    // Negative: Runt, only a tag    {        unsigned char derData[] = {0x31};        auto swPeer = parsePeerRoles(ConstDataRange(reinterpret_cast<char*>(derData),                                                    std::extent<decltype(derData)>::value));        ASSERT_NOT_OK(swPeer.getStatus());    }    // Negative: Runt, only a tag and short length    {        unsigned char derData[] = {0x31, 0x0b};        auto swPeer = parsePeerRoles(ConstDataRange(reinterpret_cast<char*>(derData),                                                    std::extent<decltype(derData)>::value));        ASSERT_NOT_OK(swPeer.getStatus());    }    // Negative: Runt, only a tag and long length with wrong missing length    {        unsigned char derData[] = {            0x31, 0x88, 0xff, 0xff,        };        auto swPeer = parsePeerRoles(ConstDataRange(reinterpret_cast<char*>(derData),//.........这里部分代码省略.........
开发者ID:hanumantmk,项目名称:mongo,代码行数:101,


示例15: run

    void run() {        AutoGetCollectionForRead ctx(&_txn, nss.ns());        Collection* collection = ctx.getCollection();        ASSERT(collection);        // Query can be answered by either index on "a" or index on "b".        auto statusWithCQ = CanonicalQuery::canonicalize(nss, fromjson("{a: {$gte: 8}, b: 1}"));        ASSERT_OK(statusWithCQ.getStatus());        const std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());        // We shouldn't have anything in the plan cache for this shape yet.        PlanCache* cache = collection->infoCache()->getPlanCache();        ASSERT(cache);        CachedSolution* rawCachedSolution;        ASSERT_NOT_OK(cache->get(*cq, &rawCachedSolution));        // Get planner params.        QueryPlannerParams plannerParams;        fillOutPlannerParams(&_txn, collection, cq.get(), &plannerParams);        // Set up queued data stage to take a long time before returning EOF. Should be long        // enough to trigger a replan.        const size_t decisionWorks = 10;        const size_t mockWorks =            1U + static_cast<size_t>(internalQueryCacheEvictionRatio * decisionWorks);        auto mockChild = stdx::make_unique<QueuedDataStage>(&_txn, &_ws);        for (size_t i = 0; i < mockWorks; i++) {            mockChild->pushBack(PlanStage::NEED_TIME);        }        CachedPlanStage cachedPlanStage(            &_txn, collection, &_ws, cq.get(), plannerParams, decisionWorks, mockChild.release());        // This should succeed after triggering a replan.        PlanYieldPolicy yieldPolicy(nullptr, PlanExecutor::YIELD_MANUAL);        ASSERT_OK(cachedPlanStage.pickBestPlan(&yieldPolicy));        // Make sure that we get 2 legit results back.        size_t numResults = 0;        PlanStage::StageState state = PlanStage::NEED_TIME;        while (state != PlanStage::IS_EOF) {            WorkingSetID id = WorkingSet::INVALID_ID;            state = cachedPlanStage.work(&id);            ASSERT_NE(state, PlanStage::FAILURE);            ASSERT_NE(state, PlanStage::DEAD);            if (state == PlanStage::ADVANCED) {                WorkingSetMember* member = _ws.get(id);                ASSERT(cq->root()->matchesBSON(member->obj.value()));                numResults++;            }        }        ASSERT_EQ(numResults, 2U);        // This time we expect to find something in the plan cache. Replans after hitting the        // works threshold result in a cache entry.        ASSERT_OK(cache->get(*cq, &rawCachedSolution));        const std::unique_ptr<CachedSolution> cachedSolution(rawCachedSolution);    }
开发者ID:alabid,项目名称:mongo,代码行数:61,



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


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