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
36 changes: 36 additions & 0 deletions tdd_intro/homework/00_intro/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,39 @@ For example: input: "cool" output: "looc"
*/

#include <gtest/gtest.h>

const std::string g_testStringCool = "cool";
const std::string g_testReverseStringCool = "looc";
const std::string g_testString12345 = "12345";
const std::string g_testReverseString12345 = "54321";
const std::string g_testString123456 = "123456";
const std::string g_testReverseString123456 = "654321";
const std::string g_testOutOfScopeCaseString = "some random input to cover more cases";
const std::string g_testReverseOutOfScopeCaseString = "sesac erom revoc ot tupni modnar emos";

std::string ReverseAString(const std::string& target)
Copy link
Collaborator

Choose a reason for hiding this comment

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

один большой жирный коммит :( я не увидел, что было в первом красном тесте, а целом отлично

{
std::string result(target);
std::reverse(result.begin(), result.end());
return result;
}

TEST(reverse, CheckCoolString)
Copy link
Collaborator

Choose a reason for hiding this comment

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

нет простых тестов (один символ, два)

{
ASSERT_EQ(g_testReverseStringCool, ReverseAString(g_testStringCool));
}

TEST(reverse, Check12345String)
{
ASSERT_EQ(g_testReverseString12345, ReverseAString(g_testString12345));
}

TEST(reverse, Check123456String)
{
ASSERT_EQ(g_testReverseString123456, ReverseAString(g_testString123456));
}

TEST(reverse, CheckOtherString)
{
ASSERT_EQ(g_testReverseOutOfScopeCaseString, ReverseAString(g_testOutOfScopeCaseString));
}
1 change: 1 addition & 0 deletions tdd_intro/homework/homework.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
TEMPLATE = subdirs

SUBDIRS += \
00_intro \
01_leap_year \
02_ternary_numbers \
03_bank_ocr \
Expand Down