mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
31 lines
791 B
C++
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
|