Files
nearby/cpp/platform/base/byte_utils_test.cc
T
2020-11-23 22:28:06 -08:00

31 lines
791 B
C++

#include "platform/base/byte_utils.h"
#include "platform/base/byte_array.h"
#include "gtest/gtest.h"
namespace location {
namespace nearby {
constexpr absl::string_view kFooBytes{"rawABCDE"};
constexpr absl::string_view kFooFourDigitsToken{"0392"};
constexpr absl::string_view kEmptyFourDigitsToken{"0000"};
TEST(ByteUtilsTest, ToFourDigitStringCorrect) {
ByteArray bytes{std::string(kFooBytes)};
auto four_digit_string = ByteUtils::ToFourDigitString(bytes);
EXPECT_EQ(std::string(kFooFourDigitsToken), four_digit_string);
}
TEST(ByteUtilsTest, TestEmptyByteArrayCorrect) {
ByteArray bytes;
auto four_digit_string = ByteUtils::ToFourDigitString(bytes);
EXPECT_EQ(std::string(kEmptyFourDigitsToken), four_digit_string);
}
} // namespace nearby
} // namespace location