mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 14:16:09 -06:00
.bazzar Added Google Test to bazzar with appropriate example
git-svn-id: svn://ultimatepp.org/upp/trunk@9401 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9864ee317c
commit
b0555fb43b
41 changed files with 31827 additions and 0 deletions
51
bazaar/GoogleTestExample/StringTest.cpp
Normal file
51
bazaar/GoogleTestExample/StringTest.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include "StringTest.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
void StringTest::SetUp()
|
||||
{
|
||||
sCat = "Cat";
|
||||
sDog = "Dog";
|
||||
}
|
||||
|
||||
TEST_F(StringTest, TestDefaultConstructor)
|
||||
{
|
||||
String a;
|
||||
|
||||
ASSERT_EQ(a, "");
|
||||
}
|
||||
|
||||
TEST_F(StringTest, TestConstructor)
|
||||
{
|
||||
String a("Test");
|
||||
ASSERT_EQ(a, "Test");
|
||||
}
|
||||
|
||||
TEST_F(StringTest, TestGetCount)
|
||||
{
|
||||
ASSERT_EQ(sEmpty.GetCount(), 0);
|
||||
ASSERT_EQ(sCat.GetCount(), 3);
|
||||
ASSERT_EQ(sDog.GetCount(), 3);
|
||||
}
|
||||
|
||||
TEST_F(StringTest, TestClear)
|
||||
{
|
||||
sCat.Clear();
|
||||
|
||||
ASSERT_EQ(sCat, "");
|
||||
ASSERT_EQ(sCat.GetCount(), 0);
|
||||
}
|
||||
|
||||
TEST_F(StringTest, TestCompare)
|
||||
{
|
||||
ASSERT_EQ(sCat.Compare(sCat), 0);
|
||||
ASSERT_EQ(sCat.Compare(sDog), -1);
|
||||
}
|
||||
|
||||
TEST_F(StringTest, TestEqual)
|
||||
{
|
||||
ASSERT_TRUE(sCat.IsEqual(sCat));
|
||||
ASSERT_FALSE(sCat.IsEqual(sDog));
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
Loading…
Add table
Add a link
Reference in a new issue