mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Make BT MacAddress optional in Private certs.
PiperOrigin-RevId: 797357330
This commit is contained in:
committed by
Copybara-Service
parent
f8e3f97c4e
commit
29f37997ec
@@ -15,7 +15,6 @@
|
||||
#include "internal/base/bluetooth_address.h"
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "absl/types/span.h"
|
||||
@@ -32,28 +31,6 @@ TEST(BluetoothUtil, ParseBluetoothAddress) {
|
||||
EXPECT_EQ(output, expected_output);
|
||||
}
|
||||
|
||||
TEST(BluetoothUtil, ConvertBluetoothAddressUIntToString) {
|
||||
const uint64_t input = 0x00001A2B3C4D5E6F;
|
||||
std::string expected_output = "1A:2B:3C:4D:5E:6F";
|
||||
std::string output = ConvertBluetoothAddressUIntToString(input);
|
||||
EXPECT_EQ(output, expected_output);
|
||||
}
|
||||
|
||||
TEST(BluetoothUtil, CanonicalizeBluetoothAddress) {
|
||||
std::array<uint8_t, 6> address{{26, 43, 60, 77, 94, 111}};
|
||||
EXPECT_EQ(CanonicalizeBluetoothAddress(address), "1A:2B:3C:4D:5E:6F");
|
||||
EXPECT_EQ(CanonicalizeBluetoothAddress("1A-2B-3C-4D-5E-6F"),
|
||||
"1A:2B:3C:4D:5E:6F");
|
||||
EXPECT_EQ(CanonicalizeBluetoothAddress(0x00001A2B3C4D5E6F),
|
||||
"1A:2B:3C:4D:5E:6F");
|
||||
|
||||
// Canonicalizes invalid address
|
||||
EXPECT_EQ(CanonicalizeBluetoothAddress("1A-2B-3C-4D-5E-6F-89"), "");
|
||||
EXPECT_EQ(CanonicalizeBluetoothAddress("nearby"), "");
|
||||
EXPECT_EQ(CanonicalizeBluetoothAddress("MA-2M-3C-4D-5E-6F"), "");
|
||||
EXPECT_EQ(CanonicalizeBluetoothAddress(0x001A2B3C4D5E6F89), "");
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace device
|
||||
} // namespace nearby
|
||||
|
||||
Reference in New Issue
Block a user