Skip to content

Commit

Permalink
unittests: revert some changes to fix unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
  • Loading branch information
AenBleidd committed Sep 10, 2024
1 parent 1ad881d commit 3be93da
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/unit-tests/lib/test_str_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,11 @@ namespace test_str_util {

TEST_F(test_str_util, lf_terminate) {
char *buf;
const size_t buf_size = 256;
buf = (char*)malloc(buf_size);
strncpy(buf, "no\nlf ending", buf_size);
buf = (char*)malloc(256);
strcpy(buf, "no\nlf ending");
buf = lf_terminate(buf);
EXPECT_STREQ(buf, "no\nlf ending\n");
strncpy(buf, "lf\n ending\n", buf_size);
strcpy(buf, "lf\n ending\n");
buf = lf_terminate(buf);
EXPECT_STREQ(buf, "lf\n ending\n");
}
Expand Down Expand Up @@ -391,7 +390,7 @@ namespace test_str_util {
EXPECT_STREQ(buf, "blah");
EXPECT_EQ(path_to_filename("hellokeith", buf), 0);
EXPECT_STREQ(buf, "hellokeith");
strncpy(buf, "", 2);
strcpy(buf, "");
EXPECT_EQ(path_to_filename("/home/blah/", buf), -2);
EXPECT_STREQ(buf, "");
EXPECT_EQ(path_to_filename("", buf), -1);
Expand Down

0 comments on commit 3be93da

Please sign in to comment.