-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add app unit tests to app internal integration test #1046
base: main
Are you sure you want to change the base?
Conversation
for (int i = 0; i < args_vector.size(); ++i) { | ||
const char* arg = args_vector[i].c_str(); | ||
char* arg_copy = new char[std::strlen(arg) + 1]; | ||
std::strcpy(arg_copy, arg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost always, snprintf is better than strcpy
|
||
// Blocking HTTP request helper function, for testing only. | ||
static bool SendHttpPostRequest( | ||
const char* url, const std::map<std::string, std::string>& headers, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add #include <map> for map<>
static bool Base64Encode(const std::string& input, std::string* output); | ||
// Decode a base64 string to binary. Returns true if the decoding succeeded, | ||
// false if it failed. | ||
static bool Base64Decode(const std::string& input, std::string* output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add #include <string> for string
@@ -82,12 +81,14 @@ using testing::Not; | |||
|
|||
namespace firebase { | |||
|
|||
extern std::string g_test_srcdir; | |||
std::string g_test_srcdir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Static/global string variables are not permitted.
EXPECT_EQ(encoded_firebase, encoded_openssh) | ||
<< "Encoding mismatch on source buffer: " << orig; | ||
|
||
std::string decoded_firebase_to_openssh; | ||
std::string decoded_openssh_to_firebase; | ||
ASSERT_TRUE(Base64Decode(encoded_openssh, &decoded_openssh_to_firebase)); | ||
ASSERT_TRUE(OpenSSHDecode(encoded_firebase, &decoded_firebase_to_openssh)); | ||
ASSERT_TRUE(OpenSSHDecode(&encoded_firebase[0], encoded_firebase.length(), | ||
&decoded_firebase_to_openssh)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tab found; better to use spaces
Description
Testing
Type of Change
Place an
x
the applicable box:Notes
Release Notes
section ofrelease_build_files/readme.md
.