-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ssg]: Use C++ strings for text handling (#18596)
Replace char* and C string functions with C++ strings.
- Loading branch information
1 parent
6bfb85a
commit 1e1876a
Showing
4 changed files
with
148 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,8 +181,7 @@ class SsgMainTest : public SsgFunctionTest { | |
|
||
/* Find a string in a file */ | ||
bool find_string_in_file(std::string str, | ||
std::string file_name, | ||
int num_asics) { | ||
std::string file_name) { | ||
bool found = false; | ||
std::string line; | ||
|
||
|
@@ -214,7 +213,7 @@ class SsgMainTest : public SsgFunctionTest { | |
/* Run once for single instance */ | ||
finished = true; | ||
} | ||
EXPECT_EQ(find_string_in_file(str_t, target, num_asics), | ||
EXPECT_EQ(find_string_in_file(str_t, target), | ||
expected_result) | ||
<< "Error validating " + str_t + " in " + target; | ||
} | ||
|
@@ -460,9 +459,8 @@ TEST_F(SsgFunctionTest, insert_instance_number) { | |
char input[] = "[email protected]"; | ||
for (int i = 0; i <= 100; ++i) { | ||
std::string out = "test@" + std::to_string(i) + ".service"; | ||
char* ret = insert_instance_number(input, i); | ||
ASSERT_NE(ret, nullptr); | ||
EXPECT_STREQ(ret, out.c_str()); | ||
std::string ret = insert_instance_number(input, i); | ||
EXPECT_EQ(ret, out); | ||
} | ||
} | ||
|
||
|
@@ -513,7 +511,6 @@ TEST_F(SsgFunctionTest, get_unit_files) { | |
|
||
/* TEST ssg_main() argv error */ | ||
TEST_F(SsgMainTest, ssg_main_argv) { | ||
FILE* fp; | ||
std::vector<char*> argv_; | ||
std::vector<std::string> arguments = { | ||
"ssg_main", | ||
|
Oops, something went wrong.