mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Migrate usage of BluetoothUtils::ToString() to MacAddress
PiperOrigin-RevId: 762184790
This commit is contained in:
committed by
Copybara-Service
parent
96a274a58f
commit
acaf963c40
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/hash/hash_testing.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
|
||||
namespace {
|
||||
@@ -103,6 +104,27 @@ TEST(ByteArrayTest, CreateFromAbslStringReturnsTheSame) {
|
||||
EXPECT_EQ(bytes.AsStringView(), kTestString);
|
||||
}
|
||||
|
||||
TEST(ByteArrayTest, Read6BytesAsUint64EmptyByteArrayReturnsError) {
|
||||
ByteArray bytes;
|
||||
auto result = bytes.Read6BytesAsUint64();
|
||||
EXPECT_FALSE(result.ok());
|
||||
EXPECT_EQ(result.status().code(), absl::StatusCode::kFailedPrecondition);
|
||||
}
|
||||
|
||||
TEST(ByteArrayTest, Read6BytesAsUint64NotEnoughBytesReturnsError) {
|
||||
ByteArray bytes({0x01, 0x02, 0x03, 0x04, 0x05});
|
||||
auto result = bytes.Read6BytesAsUint64();
|
||||
EXPECT_FALSE(result.ok());
|
||||
EXPECT_EQ(result.status().code(), absl::StatusCode::kFailedPrecondition);
|
||||
}
|
||||
|
||||
TEST(ByteArrayTest, Read6BytesAsUint64) {
|
||||
ByteArray bytes({0x01, 0x02, 0x03, 0x04, 0x05, 0x06});
|
||||
auto result = bytes.Read6BytesAsUint64();
|
||||
EXPECT_TRUE(result.ok());
|
||||
EXPECT_EQ(bytes.Read6BytesAsUint64().value(), 0x010203040506);
|
||||
}
|
||||
|
||||
TEST(ByteArrayTest, IteratorTypes) {
|
||||
static_assert(std::same_as<decltype(std::declval<ByteArray>().begin()),
|
||||
ByteArray::iterator>);
|
||||
|
||||
Reference in New Issue
Block a user