-

   rss_habrahabr_of_lokoman

 - e-mail

 

 -

 LiveInternet.ru:
: 16.03.2008
:
:
: 2

:


[ ] C++

, 31 2018 . 19:58 +

, Google Test, Catch2, Boost.Test , :


namespace {

// Tests the default c'tor.
TEST(MyString, DefaultConstructor) {
  const MyString s;
  EXPECT_STREQ(nullptr, s.c_string());
  EXPECT_EQ(0u, s.Length());
}

const char kHelloString[] = "Hello, world!";

// Tests the c'tor that accepts a C string.
TEST(MyString, ConstructorFromCString) {
  const MyString s(kHelloString);
  EXPECT_EQ(0, strcmp(s.c_string(), kHelloString));
  EXPECT_EQ(sizeof(kHelloString)/sizeof(kHelloString[0]) - 1,
            s.Length());
}

// Tests the copy c'tor.
TEST(MyString, CopyConstructor) {
  const MyString s1(kHelloString);
  const MyString s2 = s1;
  EXPECT_EQ(0, strcmp(s2.c_string(), kHelloString));
}
}  // namespace

C++ , ?

https://habr.com/post/434906/?utm_source=habrahabr&utm_medium=rss&utm_campaign=434906

:  

: [1] []
 

:
: 

: ( )

:

  URL