Bazzar: Google test example packages naming simplification.

git-svn-id: svn://ultimatepp.org/upp/trunk@14993 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
klugier 2020-09-06 11:32:01 +00:00
parent e39620c940
commit eee1bd4e46
13 changed files with 27 additions and 28 deletions

View file

@ -0,0 +1,16 @@
description "Unit test package that shows how Google Test works with U++\377";
uses
plugin/gtest,
Core;
file
Init readonly separator,
main.cpp,
Tests readonly separator,
StringTest.cpp,
StringTest.h;
mainconfig
"" = "";

View 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));
}
}

View 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() override;
protected:
String sEmpty;
String sCat;
String sDog;
};
}
#endif

View file

@ -0,0 +1,3 @@
#include <plugin/gtest/gtest.h>
TEST_APP_MAIN {}