예제 #1
0
IUTEST(SyntaxTest, Null)
{
    int* p = NULL;
    if( int x = 1 )
        IUTEST_ASSERT_NULL(p) << x;
    if( int x = 1 )
        IUTEST_EXPECT_NULL(p) << x;
    if( int x = 1 )
        IUTEST_INFORM_NULL(p) << x;
    if( int x = 1 )
        IUTEST_ASSUME_NULL(p) << x;
}
예제 #2
0
int main(int argc, char* argv[])
#endif
{
    IUTEST_INIT(&argc, argv);
#if defined(OUTPUTXML)
    // 実行対象テストがないので xml 出力しない
    ::iutest::IUTEST_FLAG(output) = NULL;
#endif

#if !defined(IUTEST_USE_GTEST)
    TestLogger logger;
    ::iutest::detail::iuConsole::SetLogger(&logger);
#endif

    ::iutest::TestEventListener* listener = ::iuutil::QuietResultPrinter::SetUp();
#if IUTEST_HAS_ASSERTION_RETURN
    IUTEST_ASSERT_NOTNULL( listener ) << ::iutest::AssertionReturn<int>(1);
#else
    if( listener == NULL ) return 1;
#endif

    if( IUTEST_RUN_ALL_TESTS() == 0 ) return 1;
#if !defined(IUTEST_USE_GTEST) && IUTEST_HAS_ASSERTION_RETURN
    IUTEST_ASSERT_STRNOTIN("[       OK ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
    IUTEST_ASSERT_STRIN   ("[  FAILED  ]", logger.c_str()) << ::iutest::AssertionReturn<int>(1);
#endif

    {
        ::iutest::TestEventListeners& listeners = ::iutest::UnitTest::GetInstance()->listeners();
        delete listeners.Release(listener);
    }

    listener = ::iuutil::QuietResultPrinter::SetUp();
#if IUTEST_HAS_ASSERTION_RETURN
    IUTEST_ASSERT_NULL( listener ) << ::iutest::AssertionReturn<int>(1);
#else
    if( listener != NULL ) return 1;
#endif

    printf("*** Successful ***\n");
    return 0;
}