mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Fixed unit tests. Unit tests were failing locally, mostly just type mismatches, but there was an error in the GetDownloadPath for the test utilities.
PiperOrigin-RevId: 474358069
This commit is contained in:
committed by
Copybara-Service
parent
6b5251f8d2
commit
0b57cd5c5f
@@ -16,8 +16,12 @@
|
||||
|
||||
#include <shlobj.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/strings/str_replace.h"
|
||||
|
||||
namespace test_utils {
|
||||
std::wstring StringToWideString(const std::string& s) {
|
||||
int len;
|
||||
@@ -60,11 +64,12 @@ std::string GetPayloadPath(location::nearby::PayloadId payload_id) {
|
||||
|
||||
CoTaskMemFree(basePath);
|
||||
|
||||
std::stringstream path("");
|
||||
std::string path =
|
||||
absl::StrFormat("%s\\%s", fullPath, std::to_string(payload_id));
|
||||
|
||||
path << fullPath << "\\" << std::to_string(payload_id);
|
||||
path = absl::StrReplaceAll(path, {{"\\", "/"}});
|
||||
|
||||
return path.str();
|
||||
return path;
|
||||
}
|
||||
|
||||
} // namespace test_utils
|
||||
|
||||
@@ -49,7 +49,8 @@ TEST(UtilsTests, StringToMacAddress) {
|
||||
}
|
||||
|
||||
constexpr absl::string_view kIpDotdecimal{"192.168.1.37"};
|
||||
constexpr char kIp4Bytes[] = {192, 168, 1, 37};
|
||||
|
||||
constexpr char kIp4Bytes[] = {(char)192, (char)168, (char)1, (char)37};
|
||||
|
||||
TEST(UtilsTests, Ip4BytesToDotdecimal) {
|
||||
std::string result =
|
||||
@@ -62,7 +63,7 @@ TEST(UtilsTests, IpDotdecimalTo4Bytes) {
|
||||
std::string result =
|
||||
ipaddr_dotdecimal_to_4bytes_string(std::string(kIpDotdecimal));
|
||||
|
||||
EXPECT_EQ(result, std::string(kIp4Bytes));
|
||||
EXPECT_EQ(result, std::string(kIp4Bytes, 4));
|
||||
}
|
||||
|
||||
} // namespace windows
|
||||
|
||||
Reference in New Issue
Block a user