mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -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
16
bazaar/GoogleTestExample/GoogleTestExample.upp
Normal file
16
bazaar/GoogleTestExample/GoogleTestExample.upp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
description "Example of usage Google Test\377";
|
||||
|
||||
uses
|
||||
plugin/gtest,
|
||||
Core;
|
||||
|
||||
file
|
||||
Tests readonly separator,
|
||||
StringTest.h,
|
||||
StringTest.cpp,
|
||||
Init readonly separator,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
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
|
||||
21
bazaar/GoogleTestExample/StringTest.h
Normal file
21
bazaar/GoogleTestExample/StringTest.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef _GoogleTestExample_VectorTest_h_
|
||||
#define _GoogleTestExample_VectorTest_h_
|
||||
|
||||
#include <Core/Core.h>
|
||||
#include <plugin/gtest/gtest.h>
|
||||
|
||||
NAMESPACE_UPP
|
||||
|
||||
class StringTest : public testing::Test {
|
||||
protected:
|
||||
virtual void SetUp();
|
||||
|
||||
protected:
|
||||
String sEmpty;
|
||||
String sCat;
|
||||
String sDog;
|
||||
};
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
||||
#endif
|
||||
5
bazaar/GoogleTestExample/init
Normal file
5
bazaar/GoogleTestExample/init
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifndef _GoogleTestExample_icpp_init_stub
|
||||
#define _GoogleTestExample_icpp_init_stub
|
||||
#include "plugin/gtest/init"
|
||||
#include "Core/init"
|
||||
#endif
|
||||
9
bazaar/GoogleTestExample/main.cpp
Normal file
9
bazaar/GoogleTestExample/main.cpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include <iostream>
|
||||
#include <plugin/gtest/gtest.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue