Пример #1
0
IUTEST_TYPED_TEST(StrTest, String)
{
    typename TestFixture::String test1 = TestFixture::Text::test;
    typename TestFixture::String test2 = TestFixture::Text::test;
    IUTEST_ASSERT_STREQ(test1, TestFixture::Text::test);
    IUTEST_EXPECT_STREQ(test1, TestFixture::Text::test);
    IUTEST_INFORM_STREQ(test1, TestFixture::Text::test);
    IUTEST_ASSERT_STREQ(test1, test2);
    IUTEST_EXPECT_STREQ(test1, test2);
    IUTEST_INFORM_STREQ(test1, test2);
    IUTEST_ASSERT_STREQ(TestFixture::Text::test, test2);
    IUTEST_EXPECT_STREQ(TestFixture::Text::test, test2);
    IUTEST_INFORM_STREQ(TestFixture::Text::test, test2);

    typename TestFixture::String Test = TestFixture::Text::Test;
    IUTEST_ASSERT_STRNE(test1, Test);
    IUTEST_EXPECT_STRNE(test1, Test);
    IUTEST_INFORM_STRNE(test1, Test);
    IUTEST_ASSERT_STRNE(TestFixture::Text::test, Test);
    IUTEST_EXPECT_STRNE(TestFixture::Text::test, Test);
    IUTEST_INFORM_STRNE(TestFixture::Text::test, Test);
    IUTEST_ASSERT_STRNE(test1, TestFixture::Text::Test);
    IUTEST_EXPECT_STRNE(test1, TestFixture::Text::Test);
    IUTEST_INFORM_STRNE(test1, TestFixture::Text::Test);
}
Пример #2
0
IUTEST_TYPED_TEST(StrTest, Null)
{
    TypeParam* p=NULL;
    IUTEST_ASSERT_STREQ(NULL, p);
    IUTEST_EXPECT_STREQ(NULL, p);
    IUTEST_INFORM_STREQ(NULL, p);

    IUTEST_ASSERT_STRNE(TestFixture::Text::test, NULL);
    IUTEST_EXPECT_STRNE(TestFixture::Text::test, NULL);
    IUTEST_INFORM_STRNE(TestFixture::Text::test, NULL);

    IUTEST_ASSERT_STRNE(NULL, TestFixture::Text::test);
    IUTEST_EXPECT_STRNE(NULL, TestFixture::Text::test);
    IUTEST_INFORM_STRNE(NULL, TestFixture::Text::test);
}
Пример #3
0
IUTEST(DISABLED_TestFailure, Mix)
{
    IUTEST_EXPECT_EQ(0.1, 1);
    IUTEST_EXPECT_NE(0, 0);
    IUTEST_EXPECT_LE(2, 0);
    IUTEST_EXPECT_LT(0, 0);
    IUTEST_EXPECT_GE(0, 2);
    IUTEST_EXPECT_GT(0, 0);
    IUTEST_EXPECT_TRUE(0);
    IUTEST_EXPECT_FALSE(1);
    IUTEST_EXPECT_FLOAT_EQ(0.0f, 0.1f);
    IUTEST_EXPECT_DOUBLE_EQ(0.0, 0.1);
    IUTEST_EXPECT_NEAR(0, 100, 2);
    IUTEST_EXPECT_FAIL();
    {
        ::std::string str1 = "test";
        ::std::string str2 = "text";

        IUTEST_EXPECT_STREQ("text", str1);
        IUTEST_EXPECT_STRNE("text", str2);
        IUTEST_EXPECT_STRCASEEQ("Text", str1);
        IUTEST_EXPECT_STRCASENE("Text", str2);
    }
    // EQ_COLLECTIONS
    {
        int  aa[] = { 0, 1, 2, 3, 4 };
        int  ab[] = { 0, 1, 2, 3, 4, 5 };
        char ac[] = { 0, 0, 2, 3, 5 };
        IUTEST_EXPECT_EQ_COLLECTIONS(aa, aa+(sizeof(aa)/sizeof(aa[0])), ab, ab+(sizeof(ab)/sizeof(ab[0])));
        IUTEST_EXPECT_EQ_COLLECTIONS(ab, ab+(sizeof(ab)/sizeof(ab[0])), aa, aa+(sizeof(aa)/sizeof(aa[0])));
        IUTEST_EXPECT_EQ_COLLECTIONS(aa, aa+(sizeof(aa)/sizeof(aa[0])), ac, ac+(sizeof(ac)/sizeof(ac[0])));
    }
}
Пример #4
0
IUTEST_TYPED_TEST(StrTest, Raw)
{
    const TypeParam* p = TestFixture::Text::test;
    IUTEST_ASSERT_STREQ(TestFixture::Text::test, p);
    IUTEST_EXPECT_STREQ(TestFixture::Text::test, p);
    IUTEST_INFORM_STREQ(TestFixture::Text::test, p);

    IUTEST_ASSERT_STRNE(TestFixture::Text::Test, p);
    IUTEST_EXPECT_STRNE(TestFixture::Text::Test, p);
    IUTEST_INFORM_STRNE(TestFixture::Text::Test, p);
}
Пример #5
0
IUTEST(SyntaxTest, StrNe)
{
    const char test[] = "Test";
    if( const char* p = "test" )
        IUTEST_ASSERT_STRNE(p, test) << p;
    if( const char* p = "test" )
        IUTEST_EXPECT_STRNE(p, test) << p;
    if( const char* p = "test" )
        IUTEST_INFORM_STRNE(p, test) << p;
    if( const char* p = "test" )
        IUTEST_ASSUME_STRNE(p, test) << p;
}
Пример #6
0
IUTEST(AssertionTest, String)
{
    const char mbs[] = "test";
    const wchar_t wcs[] = L"test";
    IUTEST_EXPECT_STREQ( "test", mbs);
    IUTEST_EXPECT_STREQ(L"test", wcs);

    IUTEST_EXPECT_STRNE( "host", mbs);
    IUTEST_EXPECT_STRNE(L"host", wcs);

    IUTEST_EXPECT_STRLNEQ(4, mbs);
    IUTEST_EXPECT_STRLNEQ(4, wcs);

    {
        ::std::string str1 = "test";
        IUTEST_EXPECT_EQ(str1, "test");

        IUTEST_EXPECT_NE(str1, "host");
    }

    {
        ::std::string str1 = "tEst";
        ::std::string str2 = "teSt";
        ::std::string str3 = "hoSt";

        IUTEST_EXPECT_STRCASEEQ("TeSt", mbs);
        IUTEST_EXPECT_STRCASEEQ("TeSt", str1);
        IUTEST_EXPECT_STRCASEEQ(str1, "TeSt");
        IUTEST_EXPECT_STRCASEEQ(str1, str2);

        IUTEST_EXPECT_STRCASENE("HoSt", mbs);
        IUTEST_EXPECT_STRCASENE("HoSt", str1);
        IUTEST_EXPECT_STRCASENE(str1, "HoSt");
        IUTEST_EXPECT_STRCASENE(str1, str3);
    }
}