當前位置: 首頁>>代碼示例>>C++>>正文


C++ ASSERT_NO_FATAL_FAILURE函數代碼示例

本文整理匯總了C++中ASSERT_NO_FATAL_FAILURE函數的典型用法代碼示例。如果您正苦於以下問題:C++ ASSERT_NO_FATAL_FAILURE函數的具體用法?C++ ASSERT_NO_FATAL_FAILURE怎麽用?C++ ASSERT_NO_FATAL_FAILURE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ASSERT_NO_FATAL_FAILURE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的ASSERT_NO_FATAL_FAILURE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。