Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
17 changes: 17 additions & 0 deletions tdd_intro/homework/02_ternary_numbers/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ The last place in a ternary number is the 1's place. The second to last is the 3

If your language provides a method in the standard library to perform the conversion, pretend it doesn't exist and implement it yourself.
*/

#include <gtest/gtest.h>

int IntFromTernaryNumberString(const std::string& ternaryNumberString)
{
return ternaryNumberString.front() - '0';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

как только ты добавляешь front() или back() сразу стоит задуматься о тесте с пустой строкой :)

}

TEST(IntFromTernaryNumberString, one)
{
EXPECT_EQ(1, IntFromTernaryNumberString("1"));
}

TEST(IntFromTernaryNumberString, two)
{
EXPECT_EQ(2, IntFromTernaryNumberString("2"));
}
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/06_coffee/06_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
4 changes: 2 additions & 2 deletions tdd_intro/homework/homework.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ SUBDIRS += \
02_ternary_numbers \
03_bank_ocr \
04_weather_client \
05_word_wrapp \
06_coffee
05_word_wrapp
# 06_coffee