Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@
*.exe
*.out
*.app
build
.DS_Store
*.pro.user
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@
#include "gmock/internal/gmock-port.h"
#include "gtest/gtest.h"

namespace {

const testing::internal::RelationToSourceCopy kCopy;
const testing::internal::RelationToSourceReference kReference;

}

namespace testing {
namespace internal {

Expand Down
4 changes: 2 additions & 2 deletions tdd_intro/cleanroom/cleanroom.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TEMPLATE = subdirs

SUBDIRS += \
chatclient
#SUBDIRS += \
# chatclient
4 changes: 2 additions & 2 deletions tdd_intro/gtest.pri
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../3rd_party/gtest/release/ -lgtest
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../3rd_party/gtest/debug/ -lgtest
else:unix:!macx: LIBS += -L$$OUT_PWD/../../3rd_party/gtest/ -lgtest
else:unix: LIBS += -L$$OUT_PWD/../../3rd_party/gtest/ -lgtest

INCLUDEPATH += $$PWD/3rd_party/gtest/googletest/include
DEPENDPATH += $$PWD/3rd_party/gtest/googletest/include
Expand All @@ -10,4 +10,4 @@ win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../3rd_
else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../3rd_party/gtest/debug/libgtest.a
else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../3rd_party/gtest/release/gtest.lib
else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../3rd_party/gtest/debug/gtest.lib
else:unix:!macx: PRE_TARGETDEPS += $$OUT_PWD/../../3rd_party/gtest/libgtest.a
else:unix: PRE_TARGETDEPS += $$OUT_PWD/../../3rd_party/gtest/libgtest.a
45 changes: 45 additions & 0 deletions tdd_intro/homework/01_leap_year/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,48 @@ If your language provides a method in the standard library that does this look-u
*/

#include <gtest/gtest.h>

bool is_multiple(int number, int base)
{
return number % base == 0;
}

bool is_leap_year(int year)
{
if (is_multiple(year, 400))
{
return true;
}

if (is_multiple(year, 100))
{
return false;
}

if (is_multiple(year, 4))
{
return true;
}

return false;
}

TEST(is_leap_year, returns_true_for_4)
{
EXPECT_TRUE(is_leap_year(4));
}

TEST(is_leap_year, returns_false_for_5)
{
EXPECT_FALSE(is_leap_year(5));
}

TEST(is_leap_year, returns_false_for_100)
{
EXPECT_FALSE(is_leap_year(100));
}

TEST(is_leap_year, returns_true_for_400)
{
EXPECT_TRUE(is_leap_year(400));
}
1 change: 1 addition & 0 deletions tdd_intro/homework/04_weather_client/04_weather_client.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
include(../../gmock.pri)
include(../../gtest.pri)

TEMPLATE = app
CONFIG += console c++11
Expand Down
2 changes: 2 additions & 0 deletions tdd_intro/homework/04_weather_client/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Each line means "<request>" : "<response>":
#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include <cmath>

struct Weather
{
short temperature = 0;
Expand Down
1 change: 1 addition & 0 deletions tdd_intro/homework/05_coffee/05_coffee.pro
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include(../../gtest.pri)
include(../../gmock.pri)

TEMPLATE = app
Expand Down