• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ASSERT_NO_FATAL_FAILURE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

void TextureRenderer::SetUp() {
    const char vsrc[] =
        "attribute vec4 vPosition;\n"
        "varying vec2 texCoords;\n"
        "uniform mat4 texMatrix;\n"
        "void main() {\n"
        "  vec2 vTexCoords = 0.5 * (vPosition.xy + vec2(1.0, 1.0));\n"
        "  texCoords = (texMatrix * vec4(vTexCoords, 0.0, 1.0)).xy;\n"
        "  gl_Position = vPosition;\n"
        "}\n";

    const char fsrc[] =
        "#extension GL_OES_EGL_image_external : require\n"
        "precision mediump float;\n"
        "uniform samplerExternalOES texSampler;\n"
        "varying vec2 texCoords;\n"
        "void main() {\n"
        "  gl_FragColor = texture2D(texSampler, texCoords);\n"
        "}\n";

    {
        SCOPED_TRACE("creating shader program");
        ASSERT_NO_FATAL_FAILURE(GLTest::createProgram(vsrc, fsrc, &mPgm));
    }

    mPositionHandle = glGetAttribLocation(mPgm, "vPosition");
    ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
    ASSERT_NE(-1, mPositionHandle);
    mTexSamplerHandle = glGetUniformLocation(mPgm, "texSampler");
    ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
    ASSERT_NE(-1, mTexSamplerHandle);
    mTexMatrixHandle = glGetUniformLocation(mPgm, "texMatrix");
    ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError());
    ASSERT_NE(-1, mTexMatrixHandle);
}
开发者ID:MIPS,项目名称:frameworks-native,代码行数:35,代码来源:TextureRenderer.cpp


示例2: TEST_F

TEST_F(WalletApi, initAndSave) {
  SaveOnInitWalletObserver saveOnInit(alice.get());
  alice->addObserver(&saveOnInit);
  alice->initAndGenerate("pass");
  ASSERT_NO_FATAL_FAILURE(WaitWalletSave(aliceWalletObserver.get()));
  alice->shutdown();
}
开发者ID:AlbertWerner,项目名称:cryptonotecoin,代码行数:7,代码来源:test_wallet.cpp


示例3: TEST_F

// Tests an interactive PTY session.
TEST_F(ShellServiceTest, InteractivePtySubprocess) {
    ASSERT_NO_FATAL_FAILURE(StartTestSubprocess(
                                "", SubprocessType::kPty, SubprocessProtocol::kShell));

    // Use variable substitution so echoed input is different from output.
    const char* commands[] = {"TEST_STR=abc123",
                              "echo --${TEST_STR}--",
                              "exit"
                             };

    ShellProtocol* protocol = new ShellProtocol(subprocess_fd_);
    for (std::string command : commands) {
        // Interactive shell requires a newline to complete each command.
        command.push_back('\n');
        memcpy(protocol->data(), command.data(), command.length());
        ASSERT_TRUE(protocol->Write(ShellProtocol::kIdStdin, command.length()));
    }
    delete protocol;

    std::string stdout, stderr;
    EXPECT_EQ(0, ReadShellProtocol(subprocess_fd_, &stdout, &stderr));
    // An unpredictable command prompt makes parsing exact output difficult but
    // it should at least contain echoed input and the expected output.
    for (const char* command : commands) {
        EXPECT_FALSE(stdout.find(command) == std::string::npos);
    }
    EXPECT_FALSE(stdout.find("--abc123--") == std::string::npos);
}
开发者ID:RajaMu,项目名称:system_core,代码行数:29,代码来源:shell_service_test.cpp


示例4: alarm

void XITServerTest::StartServer() {
    /* No test takes longer than 60 seconds unless we have some envs set
       that suggest we're actually debugging the server */
    if (!getenv("XORG_GTEST_XSERVER_SIGSTOP") &&
        !getenv("XORG_GTEST_XSERVER_KEEPALIVE") &&
        !getenv("XORG_GTEST_USE_VALGRIND")) {
        alarm(TEST_TIMEOUT);
        signal(SIGALRM, sighandler_alarm);
    }

    server.SetOption("-noreset", "");
    server.SetOption("-logverbose", "12");
    server.Start();

    std::string display;
    const char *dpy = getenv("XORG_GTEST_XSERVER_OVERRIDE_DISPLAY");
    if (dpy)
        display = std::string(dpy);
    else
        display = server.GetDisplayString();

    xorg::testing::Test::SetDisplayString(display);

    ASSERT_NO_FATAL_FAILURE(xorg::testing::Test::SetUp());
}
开发者ID:freedesktop-unofficial-mirror,项目名称:xorg__test__xorg-integration-tests,代码行数:25,代码来源:xit-server-test.cpp


示例5: getCurrentMode

 void getCurrentMode(uint32_t &w, uint32_t &h) {
     adf_interface_data data;
     ASSERT_NO_FATAL_FAILURE(getInterfaceData(data));
     w = data.current_mode.hdisplay;
     h = data.current_mode.vdisplay;
     adf_free_interface_data(&data);
 }
开发者ID:2Habibie,项目名称:platform_system_core,代码行数:7,代码来源:adf_test.cpp


示例6: TEST_F

TEST_F(DlExtRelroSharingTest, RelroFileEmpty) {
  int relro_fd = open(relro_file_, O_CREAT | O_RDWR | O_TRUNC, 0644);
  ASSERT_NOERROR(relro_fd);
  ASSERT_NOERROR(close(relro_fd));

  ASSERT_NO_FATAL_FAILURE(TryUsingRelro(LIBNAME));
}
开发者ID:Bruce-Zou,项目名称:android-actions,代码行数:7,代码来源:dlext_test.cpp


示例7: TEST_F

TEST_F(IGraphicBufferProducerTest, Query_ReturnsError) {
    ASSERT_NO_FATAL_FAILURE(ConnectProducer());

    // One past the end of the last 'query' enum value. Update this if we add more enums.
    const int NATIVE_WINDOW_QUERY_LAST_OFF_BY_ONE = NATIVE_WINDOW_BUFFER_AGE + 1;

    int value;
    // What was out of range
    EXPECT_EQ(BAD_VALUE, mProducer->query(/*what*/-1, &value));
    EXPECT_EQ(BAD_VALUE, mProducer->query(/*what*/0xDEADBEEF, &value));
    EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_QUERY_LAST_OFF_BY_ONE, &value));

    // Some enums from window.h are 'invalid'
    EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER, &value));
    EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_CONCRETE_TYPE, &value));
    EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_DEFAULT_WIDTH, &value));
    EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_DEFAULT_HEIGHT, &value));
    EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_TRANSFORM_HINT, &value));
    // TODO: Consider documented the above enums as unsupported or make a new enum for IGBP

    // Value was NULL
    EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_FORMAT, /*value*/NULL));

    ASSERT_OK(mConsumer->consumerDisconnect());

    // BQ was abandoned
    EXPECT_EQ(NO_INIT, mProducer->query(NATIVE_WINDOW_FORMAT, &value));

    // TODO: other things in window.h that are supported by Surface::query
    // but not by BufferQueue::query
}
开发者ID:debian-pkg-android-tools,项目名称:android-platform-frameworks-native,代码行数:31,代码来源:IGraphicBufferProducer_test.cpp


示例8: runWithCipher

void runWithCipher(const string& cipherName, int blockSize,
                   void (*func)(FSConfigPtr& config)) {
  shared_ptr<CipherV1> cipher = CipherV1::New(cipherName);
  ASSERT_TRUE(cipher.get() != NULL);

  FSConfigPtr cfg = makeConfig(cipher, blockSize);
  ASSERT_NO_FATAL_FAILURE(func(cfg));
}
开发者ID:UIKit0,项目名称:encfs,代码行数:8,代码来源:testing.cpp


示例9: drawTexture

 void drawTexture(bool asSRGB, GLint x, GLint y, GLsizei width,
         GLsizei height) {
     ASSERT_NO_FATAL_FAILURE(fillTexture(asSRGB));
     glViewport(x, y, width, height);
     ASSERT_EQ(GL_NO_ERROR, glGetError());
     glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
     ASSERT_EQ(GL_NO_ERROR, glGetError());
 }
开发者ID:Cheshkin,项目名称:android_frameworks_native_mtk,代码行数:8,代码来源:SRGB_test.cpp


示例10: TEST

TEST(TraceLifecycleTest, threadAttachDetachStress)
{
	/* OMR VM data structures */
	OMRTestVM testVM;
	OMR_VMThread *vmthread = NULL;
	const int attachDetachHelpersCount = 10;
	omrthread_t attachDetachHelpers[attachDetachHelpersCount];
	ChildThreadData *attachDetachData[attachDetachHelpersCount];
	omrthread_t shutdownHelper = NULL;
	ChildThreadData *shutdownData = NULL;

	OMRPORT_ACCESS_FROM_OMRPORT(rasTestEnv->getPortLibrary());
	char *datDir = getTraceDatDir(rasTestEnv->_argc, (const char **)rasTestEnv->_argv);

	OMRTEST_ASSERT_ERROR_NONE(omrTestVMInit(&testVM, OMRPORTLIB));
	/* use small buffers to exercise buffer wrapping */
	OMRTEST_ASSERT_ERROR_NONE(omr_ras_initTraceEngine(&testVM.omrVM, "buffers=1k:maximal=all", datDir));

	/* Attach the thread to the trace engine */
	OMRTEST_ASSERT_ERROR_NONE(OMR_Thread_Init(&testVM.omrVM, NULL, &vmthread, "registerSubscriberAfterShutdown"));
	UT_OMR_TEST_MODULE_LOADED(testVM.omrVM._trcEngine->utIntf);
	/* module is not unloaded before trace engine shutdown */

	for (int i = 0; i < attachDetachHelpersCount; i++) {
		ASSERT_NO_FATAL_FAILURE(startChildThread(&testVM, &attachDetachHelpers[i], attachDetachHelper, &attachDetachData[i]));
	}
	ASSERT_NO_FATAL_FAILURE(startChildThread(&testVM, &shutdownHelper, shutdownTraceHelper, &shutdownData));

	for (int i = 0; i < attachDetachHelpersCount; i++) {
		ASSERT_EQ(1, omrthread_resume(attachDetachHelpers[i]));
	}
	ASSERT_EQ(1, omrthread_resume(shutdownHelper));

	for (int i = 0; i < attachDetachHelpersCount; i++) {
		OMRTEST_ASSERT_ERROR_NONE(waitForChildThread(&testVM, attachDetachHelpers[i], attachDetachData[i]));
	}
	OMRTEST_ASSERT_ERROR_NONE(waitForChildThread(&testVM, shutdownHelper, shutdownData));

	/* Now clear up the VM we started for this test case. */
	UT_OMR_TEST_MODULE_UNLOADED(testVM.omrVM._trcEngine->utIntf);
	OMRTEST_ASSERT_ERROR_NONE(OMR_Thread_Free(vmthread));
	OMRTEST_ASSERT_ERROR_NONE(omrTestVMFini(&testVM));

	ASSERT_TRUE(NULL == (void *)omr_test_UtModuleInfo.intf);
}
开发者ID:ChengJin01,项目名称:omr,代码行数:45,代码来源:traceLifecycleTest.cpp


示例11: TEST_F

TEST_F(SelectionCollectionTest, HandlesUnsupportedRegularExpressions)
{
    if (!gmx::Regex::isSupported())
    {
        ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro"));
        EXPECT_THROW_GMX({
                             sc_.parseFromString("resname \"R[AD]\"");
                             sc_.compile();
                         }, gmx::InvalidInputError);
开发者ID:ElsevierSoftwareX,项目名称:SOFTX-D-15-00003,代码行数:9,代码来源:selectioncollection.cpp


示例12: TEST_F

TEST_F(InputPublisherAndConsumerTest, AppendMotionSample_WhenNoMotionEventPublished_ReturnsError) {
    status_t status;
    ASSERT_NO_FATAL_FAILURE(Initialize());

    PointerCoords pointerCoords[1];
    status = mPublisher->appendMotionSample(0, pointerCoords);
    ASSERT_EQ(INVALID_OPERATION, status)
            << "publisher appendMotionSample should return INVALID_OPERATION";
}
开发者ID:Abhishekh-TEL,项目名称:pdroid,代码行数:9,代码来源:InputPublisherAndConsumer_test.cpp


示例13: TEST

TEST(JoinTest, createDetachedThread)
{
	omrthread_t helperThr = NULL;

	/* We can't pass any local data to the child thread because we don't guarantee that
	 * it won't go out of scope before the child thread uses it.
	 */
	ASSERT_NO_FATAL_FAILURE(createThread(&helperThr, FALSE, J9THREAD_CREATE_DETACHED, doNothingHelper, NULL));
}
开发者ID:ChengJin01,项目名称:omr,代码行数:9,代码来源:joinTest.cpp


示例14: TEST

TEST( CFPP_WriteStream, Close )
{
    CF::WriteStream s1;
    CF::WriteStream s2( "/etc/hosts" );
    CF::WriteStream s3( "/tmp/com.xs-labs.cfpp" );
    
    s1.Open();
    s2.Open();
    s3.Open();
    
    ASSERT_NO_FATAL_FAILURE( s1.Close() );
    ASSERT_NO_FATAL_FAILURE( s2.Close() );
    ASSERT_NO_FATAL_FAILURE( s3.Close() );
    
    ASSERT_NO_THROW( s1.Close() );
    ASSERT_NO_THROW( s2.Close() );
    ASSERT_NO_THROW( s3.Close() );
}
开发者ID:DigiDNA,项目名称:CFPP,代码行数:18,代码来源:Test-CFPP-WriteStream.cpp


示例15: TEST_F

TEST_F(MotionEventTest, CopyFrom_KeepHistory) {
    MotionEvent event;
    initializeEventWithHistory(&event);

    MotionEvent copy;
    copy.copyFrom(&event, true /*keepHistory*/);

    ASSERT_NO_FATAL_FAILURE(assertEqualsEventWithHistory(&event));
}
开发者ID:MIPS,项目名称:frameworks-native,代码行数:9,代码来源:InputEvent_test.cpp


示例16: TEST_F

TEST_F(AdfTest, attach) {
    ASSERT_NO_FATAL_FAILURE(attach());
    int err = adf_device_attach(&dev, eng_id, intf_id);
    EXPECT_EQ(-EALREADY, err) << "attaching overlay engine " << eng_id <<
            " to interface " << intf_id << " twice should have failed";

    ASSERT_NO_FATAL_FAILURE(detach());
    err = adf_device_detach(&dev, eng_id, intf_id);
    EXPECT_EQ(-EINVAL, err) << "detaching overlay engine " << eng_id <<
            " from interface " << intf_id << " twice should have failed";

    err = adf_device_attach(&dev, eng_id, ADF_MAX_INTERFACES);
    EXPECT_EQ(-EINVAL, err) << "attaching overlay engine " << eng_id <<
            " to bogus interface should have failed";

    err = adf_device_detach(&dev, eng_id, ADF_MAX_INTERFACES);
    EXPECT_EQ(-EINVAL, err) << "detaching overlay engine " << eng_id <<
            " from bogus interface should have failed";
}
开发者ID:2Habibie,项目名称:platform_system_core,代码行数:19,代码来源:adf_test.cpp


示例17: TEST_F

TEST_F(WalletApi, saveAndLoadErroneousTxsCacheNoDetails) {
  prepareBobWallet();
  prepareCarolWallet();

  alice->initAndGenerate("pass");

  ASSERT_NO_FATAL_FAILURE(WaitWalletSync(aliceWalletObserver.get()));

  ASSERT_NO_FATAL_FAILURE(GetOneBlockReward(*alice));
  generator.generateEmptyBlocks(10);
  alice->startRefresh();
  ASSERT_NO_FATAL_FAILURE(WaitWalletSync(aliceWalletObserver.get()));

  bob->initAndGenerate("pass");
  ASSERT_NO_FATAL_FAILURE(WaitWalletSync(bobWalletObserver.get()));

  carol->initAndGenerate("pass");
  ASSERT_NO_FATAL_FAILURE(WaitWalletSync(carolWalletObserver.get()));

  std::array<int64_t, 5> amounts;
  amounts[0] = 1234567;
  amounts[1] = 1345678;
  amounts[2] = 1456789;
  amounts[3] = 1567890;
  amounts[4] = 1678901;
  uint64_t fee = 10000;

  ASSERT_NO_FATAL_FAILURE(performTransferWithErrorTx(amounts, fee));

  std::stringstream archive;
  alice->save(archive, false, true);

  ASSERT_NO_FATAL_FAILURE(WaitWalletSave(aliceWalletObserver.get()));

  prepareAliceWallet();
  alice->initAndLoad(archive, "pass");

  std::error_code result;
  ASSERT_NO_FATAL_FAILURE(WaitWalletLoad(aliceWalletObserver.get(), result));
  ASSERT_EQ(result.value(), 0);

  EXPECT_EQ(alice->getTransactionCount(), 2);
  EXPECT_EQ(alice->getTransferCount(), 0);

  CryptoNote::Transaction tx;
  ASSERT_TRUE(alice->getTransaction(1, tx));
  EXPECT_EQ(tx.totalAmount, amounts[3] + amounts[4] + fee);
  EXPECT_EQ(tx.firstTransferId, CryptoNote::INVALID_TRANSFER_ID);
  EXPECT_EQ(tx.transferCount, 0);

  alice->shutdown();
}
开发者ID:1annunaki,项目名称:cryptonote,代码行数:52,代码来源:test_wallet.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ASSERT_NO_THROW函数代码示例发布时间:2022-05-30
下一篇:
C++ ASSERT_NOT_REACHED函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap