Пример #1
0
IUTEST_TYPED_TEST(StrCaseTest, Raw)
{
    const TypeParam* p = TestFixture::Text::test;
    IUTEST_ASSERT_STRCASEEQ(TestFixture::Text::test, p);
    IUTEST_EXPECT_STRCASEEQ(TestFixture::Text::test, p);
    IUTEST_INFORM_STRCASEEQ(TestFixture::Text::test, p);
    IUTEST_ASSERT_STRCASEEQ(TestFixture::Text::Test, p);
    IUTEST_EXPECT_STRCASEEQ(TestFixture::Text::Test, p);
    IUTEST_INFORM_STRCASEEQ(TestFixture::Text::Test, p);

    IUTEST_ASSERT_STRCASENE(TestFixture::Text::host, p);
    IUTEST_EXPECT_STRCASENE(TestFixture::Text::host, p);
    IUTEST_INFORM_STRCASENE(TestFixture::Text::host, p);
}
Пример #2
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])));
    }
}
Пример #3
0
IUTEST(SyntaxTest, StrCaseEq)
{
    const char test[] = "Test";
    if( const char* p = "test" )
        IUTEST_ASSERT_STRCASEEQ(p, test) << p;
    if( const char* p = "test" )
        IUTEST_EXPECT_STRCASEEQ(p, test) << p;
    if( const char* p = "test" )
        IUTEST_INFORM_STRCASEEQ(p, test) << p;
    if( const char* p = "test" )
        IUTEST_ASSUME_STRCASEEQ(p, test) << p;
}
Пример #4
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);
    }
}
Пример #5
0
IUTEST_TYPED_TEST(StrCaseTest, Null)
{
    TypeParam* p=NULL;

    IUTEST_ASSERT_STRCASEEQ(NULL, p);
    IUTEST_EXPECT_STRCASEEQ(NULL, p);
    IUTEST_INFORM_STRCASEEQ(NULL, p);

    IUTEST_ASSERT_STRCASENE(TestFixture::Text::test, NULL);
    IUTEST_EXPECT_STRCASENE(TestFixture::Text::test, NULL);
    IUTEST_INFORM_STRCASENE(TestFixture::Text::test, NULL);

    IUTEST_ASSERT_STRCASENE(NULL, TestFixture::Text::test);
    IUTEST_EXPECT_STRCASENE(NULL, TestFixture::Text::test);
    IUTEST_INFORM_STRCASENE(NULL, TestFixture::Text::test);
}
Пример #6
0
IUTEST_TYPED_TEST(StrCaseTest, String)
{
    typename TestFixture::String test1 = TestFixture::Text::test;
    typename TestFixture::String test2 = TestFixture::Text::test;
    IUTEST_ASSERT_STRCASEEQ(test1, TestFixture::Text::test);
    IUTEST_EXPECT_STRCASEEQ(test1, TestFixture::Text::test);
    IUTEST_INFORM_STRCASEEQ(test1, TestFixture::Text::test);
    IUTEST_ASSERT_STRCASEEQ(test1, test2);
    IUTEST_EXPECT_STRCASEEQ(test1, test2);
    IUTEST_INFORM_STRCASEEQ(test1, test2);
    IUTEST_ASSERT_STRCASEEQ(TestFixture::Text::test, test2);
    IUTEST_EXPECT_STRCASEEQ(TestFixture::Text::test, test2);
    IUTEST_INFORM_STRCASEEQ(TestFixture::Text::test, test2);

    typename TestFixture::String Test = TestFixture::Text::Test;
    IUTEST_ASSERT_STRCASEEQ(Test, TestFixture::Text::test);
    IUTEST_EXPECT_STRCASEEQ(Test, TestFixture::Text::test);
    IUTEST_INFORM_STRCASEEQ(Test, TestFixture::Text::test);
    IUTEST_ASSERT_STRCASEEQ(Test, test2);
    IUTEST_EXPECT_STRCASEEQ(Test, test2);
    IUTEST_INFORM_STRCASEEQ(Test, test2);
    IUTEST_ASSERT_STRCASEEQ(TestFixture::Text::test, Test);
    IUTEST_EXPECT_STRCASEEQ(TestFixture::Text::test, Test);
    IUTEST_INFORM_STRCASEEQ(TestFixture::Text::test, Test);

    typename TestFixture::String host = TestFixture::Text::host;
    IUTEST_ASSERT_STRCASENE(host, TestFixture::Text::test);
    IUTEST_EXPECT_STRCASENE(host, TestFixture::Text::test);
    IUTEST_INFORM_STRCASENE(host, TestFixture::Text::test);
    IUTEST_ASSERT_STRCASENE(host, test2);
    IUTEST_EXPECT_STRCASENE(host, test2);
    IUTEST_INFORM_STRCASENE(host, test2);
    IUTEST_ASSERT_STRCASENE(TestFixture::Text::test, host);
    IUTEST_EXPECT_STRCASENE(TestFixture::Text::test, host);
    IUTEST_INFORM_STRCASENE(TestFixture::Text::test, host);
}